I’m using PHP to generate JSON for JQGrid. I’ve added another property to the PHP object that I’m JSON encoding:
$sql_array = preg_split('/LIMIT/', $sql);
$pass_sql = $sql_array[0];
$response->sql = $pass_sql;
<~SNIP~>
echo json_encode($response);
This parses fine on the client side and populates the jqGrid with JSON like this:
{"page":"1","total":28,"records":"685","sql":"SELECT * FROM fires ORDER BY id desc ","rows":[{"id":"3065","cell":["Southern","Lost Fire","National Forests in Mississippi","492","100","0000-00-00",null,null,null,null,null,null,null,null,null,null,null,"3065","2011-03-03 00:00:00"]},{"id":"3064","cell":["Southern","PineTree","East Central Area Dispatch Office","420","80","2011-03-02",null,null,null,null,null,null,null,null,null,null,null,"3064","2011-03-03 00:00:00"]},{"id":"3063","cell":["Southern","LILAC ROAD","Georgia Forestry Commission","100","100","2011-03-01",null,null,null,null,null,null,null,null,null //etc
I need to pull that sql param text out of the JSON reply and hide it in a DIV for later. Is this possible?
The simplest way to send an additional information from the server to jqGrid is
userdata(see this answer. If your JSON data will be likeor
The additional information will be saved inside of jqGrid and you can access of with
$("#grid_id").jqGrid('getGridParam','userData').Be careful in the case of
userData. In the JSON data it must beuserdataand in thegetGridParam: ‘userData’.