When I try to expand a row of parent table to show a sub grid, the ID that is being passed is being generated by javascript. So the first row of the parent table gets a rowid of 1, second  the rowid of 2. So when I click to expand the subgrid for each of them, the URL that gets called is myurl.html?q=1 and myurl.html?q=2. I'm using the q=? part of the query to fetch the rows for the subgrid. 
However, the problem is that my parent rows are stored in the database with a unique id, which is not 1 2 3 etc. it is an autogenerated id by Mysql. 
Question
How can I change the behavior of parentGrid or subGrid so that when subgrid is expanded, rather than autogenerated 1, 2, 3, etc. I get the actual ID of the parent row as it is in the DB.