Forum
08:46
18/08/2010
I'm using the following to export my current grid state:
$("#tableall").jqGrid('jqGridExport',{exptype:"jsonstring"});
If I print this to an alert or innerhtml div I see my current grid configuration listed in JSON form.
If I attempt to import this by doing the following ( these actions are tied to a button on my page ) :
test_json = $("#tableall").jqGrid('jqGridExport',{exptype:"jsonstring"});
$("#tableall").jqGrid('GridUnload');
$("#tableall").jqGrid('jqGridImport',{imptype:"jsonstring", impstring: test_json, jsonGrid:{ config:"grid",data: "data"} });
I get a "ReferenceError: Can't find variable: grid" error in the javascript debugging console. I'm thinking the error is saying it can't find "grid", which is the root of my export in the json string. Everything looks right when I output the value of test_json . Do I need to change up my import line or possibly do something with the output of 'jqGridExport' before I can import it using 'jqGridImport'? I'm using jqGrid-3.7.2 with jquery jquery-1.4.2 . Thank you for the help.
23:13
18/08/2010
I'm making progress. I ended up going through grid.import.js to see what jqGridImport was doing. My thought is you feed in a json string which was generated from jqGridExport and then it should just work. Well my "ReferenceError: Can't find variable "grid" " error was due to the json string not having a grid root " {"grid": " after going through the functions. I ended up using the "json" variable ( json = $.jgrid.parse(jsonstr); ) from the JsonConvert var/function and changed my import command be "$($t).jqGrid( json );" instead of "$($t).jqGrid( gprm );" . Now I don't get an error but I get a thin grey line with no grid data. I'm thinking I'll have to change up the export string and find a way to only import certain pieces of data. I could also be using the jqGridImport line incorrectly maybe someone has some better syntax I can try.
00:08
18/08/2010
Ok I figured out a workaround instead of exporting and importing. I'm using JQGridState with jstorage backend https://bitbucket.org/rpgkaiser/jqgridstate/issue/1/column-state-not-persisted-with-columnchooser .
Most Users Ever Online: 715
Currently Online:
25 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66