I have spent a very frustrating day attempting to get grid export/import working only to find by googling StackOverflow answers that you made incompatible changes to the grid unload and in version 4.8 that you have failed to document in the main javascript wiki pages.
The only reference to these changes appears to be in http://guriddo.net/?p=123585 which is not included in the Upgrading section of the Wiki
From that page I also find that you have introduced new methods savestate and loadstate which might actually serve my needs bettter than import/export except that I can find no documentation of what is saved and where other than the demo code.
THIS IS NOT GOOD ENOUGH – Developers are not mind readers and can not be expected to trawl through unlinked pages to find information that SHOULD ALWAYS BE IN THE PRODUCT DOCUMENTATION.
There is no point you writing new functions if you don’t tell developers how to use them!
Even after updating my code to take account of your undocumented changes Import is still not working failing with
|
1 2 3 4 |
SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data b?b.toString():b})},parse:function(str){return JSON.parse(str,function(key,value... |
The data I am trying to import has come straight out of jqExportGrid and I cant see any obvious errors
{grid:{"url":"genJSON.jim","height":"auto","page":1,"rowNum":100000,"rowTotal":null,"records":2,"pager":"#pager","pgbuttons":true,"pginput":true,"colModel":[{"name":"sel","label":"Sel","width":20,"sortable":false,"search":false,"formatter":"checkbox","formatoptions":{"disabled":false},"title":true,"lso":"","hidden":false,"widthOrg":20,"resizable":true,"stype":"text"},{"name":"fname","label":"File Name","width":300,"sorttype":"text","searchoptions":{"sopt":["cn","bw","ew"]},"title":true,"lso":"","hidden":false,"widthOrg":300,"resizable":true,"sortable":true,"search":true,"stype":"text"},...
The code I am using to export import is:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$('#load').button().enable() .click(function() { $.jgrid.jqGridImport("#filelist", {imptype: "jsonstring",impstring: dirgrid}); console.log("reload grid"); }); $('#save').button().enable() .click(function() { dirgrid = jQuery("#filelist").jqGrid('jqGridExport', {exptype: "jsonstring",root: "grid"}); colmodel = jQuery("#filelist").jqGrid('getGridParam', 'colModel'); console.log(dirgrid); }); $('#empty').button().enable() .click(function() { emptygrid = $.jgrid.gridUnload("#filelist"); console.log("empty grid"); }); |
MymsMan
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top