Ajax DataGrid Support Product Page

Answered

Passing values to a details page from the grid

Asked 03 Apr 2010 20:59:18
1
has this question
03 Apr 2010 20:59:18 Chris Parker posted:
Hi, please can you help me with a simple thing.. I cant seem to pass values from a row in the grid to another page.

When I click a row I need to pass parameters to a detail page. I need to pass the 'product_id' which is the primary key and also another value from the recordset.

In the details tab I've clicked on Row Behaviours and attached a behaviour to 'Go To URL, when the row is clicked, and then selected a page and tried to set up the parameters and values in a normal DW way but it doesn't work when i preview in browser and click a row.

I tried to put curly brackets in there around the php as mentioned in a previous psot but it didn't work either...

At the moment I have:

onrowclick: "MM_goToURL('parent','productedit.php?product_id=<?php echo $row_rs_productlist['ProductID']; ?>&cat=<?php echo $row_rs_productlist['ProductCategoryID']; ?>');",

Could you tell me please whhat changes do I need to do to this line to make this pass the parameters?

Also on the Content tab in the Grid setup window how can I filter the results of the recordset with a URL parameter rather than request, Session or Server variable?

Thank you for your help - your extensions are so much better than WebAssist!

Chris

Replies

Replied 17 Apr 2010 10:31:03
17 Apr 2010 10:31:03 Chris Parker replied:
Hi I managed to get the parameter in the URL with the following code

onrowclick: "MM_goToURL('parent','orderdetails.php?order_id='+GetRowOrderID(this.innerHTML));",

It may be good to include some kind of instruction on how to pass a primary key param or varaiable from the row click as I imagine this is needed in quite a few scenarios, and there is no guidance on this in the extension guide pdf.

Thanks for a great product anyway - the Datagrid is great. I have another 2 questions about it which I will create another thread for if ok

Cheers

Chris
Replied 19 Apr 2010 10:17:27
19 Apr 2010 10:17:27 Miroslav Zografski replied:
Hello Chris,

If you had checked the other treats in the support forum you might find your solution.
It is very simple to pass a column value from the grid to GoToURL behavior by just passing the name of the column in curly brackets - {columnName} or by setting the number of the column - 1st column = {0} and etc.

Regards,
Replied 20 Oct 2011 17:50:43
20 Oct 2011 17:50:43 Luca lucag replied:
Hi

I need to send two parameters via url... like
page.asp?param1=<%=db value%>&param2=<%=db value2%>

I tried with:
"MM_goToURL('parent','page.asp?param1={columnName}&param2={columnName2}');"
but the result is:
page.asp?param1=12345&param2={columnName2}

inverted:
"MM_goToURL('parent','page.asp?param1={columnName2}&param2={columnName}');"
the result is:
page.asp?param1=ABCD&param2={columnName}

the columnName2 is before (and hidden) columnName in the javascript function

thank you
Regards
Luca
Replied 24 Oct 2011 09:33:42
24 Oct 2011 09:33:42 Miroslav Zografski replied:
Hello Luca,

Instead of ColumnName use ColumnIndex. The index is zero-based, and is referring the order of the columns in data grid.

Reply to this topic