Ajax DataGrid Support Product Page

Passing parameters to another page from the Grid

Asked 04 Mar 2010 15:35:34
1
has this question
04 Mar 2010 15:35:34 Daniel Tau posted:
Hi all-

I need to be able to do the following but I am not able to find an answer. I thought I found some answers here but they did not work. Here it goes...

1. I have a page that lists records using the AjsxDataGrid
2. These records have a field called b_id
3. I want to click on this field and pass the value of b_id over to another page where I display details about that record.

My grid is working fine, the b_id field in on the grid as hidden and it has a cell behaviour of onClick. It generates the following code:

colModel: [{
display: "Ref#",
name: "b_id",
width: 10,
sortable: true,
align: "left",
hide: false,
onclick: "MM_goToURL('parent','view.php');

I would like for the onclick to be:

onclick: "MM_goToURL('parent','view.php?bkey=b_id');
so that view.php will contain the key value I need to retrieve the record.

Any and all help will be greatly appreciated. Keep up the good work!

Daniel

Replies

Replied 05 Mar 2010 10:52:55
05 Mar 2010 10:52:55 Miroslav Zografski replied:
Hello Daniel,

what you need is simply pass the name of the column in curly parenthesis like:

 onclick: "MM_goToURL('parent','view.php?bkey={b_id}');


or pass the number of the clumn in DataGrid (starting from 0) again in curly parenthesis. Assume that the b_id is the 3th column. Then you need to pass:

onclick: "MM_goToURL('parent','view.php?bkey={2}');


Other possibility is to use the before and after fields. In your case in Content tab in Data Grid UI select the b_id column. Than in before field add:

<a href="view.php?bkey={b_id}" target="_parent">


and in the after field add :

</a>


this will wrap the content of that column into a link tag that calls the view.php and passes the value as a parameter.

That's all.

Regards,

Reply to this topic