Is there any way to force jqGrid not to remove the subgrid data when its row is toggled? My current process for loading the datagrid is as follows:
1) Setup main grid, setting subgrid up programatically with an ID that I can use later
2) Load data into main grid locally via json
3) Add data to subgrid locally via json
Due to the fact that I am loading the subgrid locally instead of by a URL when the user toggles (hides then redisplays) the grid doesn't have any data in it and I want it to display the original data that was provided to the subgrid.
I know that this may seem like a weird way of loading the data, but there is a reason
What I am currenty doing with jqGrid is displaying tons and tons of insurance information on a single web page (essentially it is a report). This web page should load all of the data automatically and I have many instances where I need to provide subgrid functionality. I have figured out how I can do this by manually forcing the click event to occur so that the subgrid will be displayed, but again, if the user clicks on the subgrid then it disappears and doesn't come back.
If you have any suggestions for this please let me know.
Also, if you think there are better ways of getting all of the data to display automaticaly please let me know that as well. So far I have found jqGrid to be easy to work with, but I have been forcing it to do things that it didn't natively do, like adding total values in the footer row.
Thank you in advance for your assistance.
What you want to do is to prevent jqGrid from reloading subgrid data when a row is expanded. The control knob for this is in the subGridOptions property of the jqGrid. The subGridOptions object has a boolean property called reloadOnExpand which controls this exact behavior.
When you initialize your jqGrid object, just make sure to set this property to false, as below:
The only place I could find this code was by doing a "View Source" on the page at their demo site that mentions this behavior. The demo page at the time of this posting is here: http://www.trirand.com/blog/phpjqgrid/examples/hierarchy/subgrid_loadonce/default.php