Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
jqGrid export and import fail with an error...
18/07/2012
15:00
Avatar
Panciom
Italia
New Member
Members
Forum Posts: 2
Member Since:
18/07/2012
sp_UserOfflineSmall Offline

Hi to all and thank you for this great piece of code.

I'm trying to make a search page with the possibility to save parameters to recall the search later.

I use the following code to show the problem:

{

    var grid_conf=jQuery("#find").jqGrid('jqGridExport',{exptype:"jsonstring"});

    jQuery("#find").jqGrid('GridUnload');
    
    jQuery("#find").jqGrid('jqGridImport',{
        imptype: 'jsonstring',
        impstring: grid_conf
    }).trigger("reloadGrid");
}


When there are filter data (toolbar with stringResult:true or dialog search) the import fail with this error (from firefox console):

Data e ora: 18/07/2012 14.02.58
Errore: invalid property id
File sorgente: https://blahblahblah/lib_js/jquery.jqGrid.min.js
Riga: 30, Colonna: 372
Codice sorgente:
}, "beforeRequest":null, "beforeProcessing":null, "onHeaderClick":null, "viewrecords":true, "loadonce":false, "multiselect":false, "multikey":false, "editurl":null, "search":true, "caption":"Ricerca estesa consegne", "hidegrid":true, "hiddengrid":false, "postData":{ "_search":true, "nd":1342612973670, "rows":20, "page":1, "sidx":"delivery_id", "sord":"desc", "filters":{"groupOp":"AND","rules":[{"field":"delivery_id","op":"eq","data":"121"}]}, "searchField":"", "searchString":"", "searchOper":"" }, "userData":{ "success":true, "session_timeout":false, "message":"" }, "treeGrid":false, "treeGridModel":"nested", "treeReader":{}, "treeANode":-1, "ExpandColumn":null, "tree_root_level":0, "prmNames":{ "page":"page", "rows":"rows", "sort":"sidx", "order":"sord", "search":"_search", "nd":"nd", "id":"id", "oper":"oper", "editoper":"edit", "addoper":"add", "deloper":"del", "subgridid":"id", "npage":null, "totalrows":"totalrows" }, "forceFit":false, "gridstate":"visible", "cellEdit":false, "cellsubmit":"remote", "nv":0, "loadui":"enable", "toolbar":[ false, "" ], "scroll":false, "multiboxonly":false, "deselectAfterSort":true, "scrollrows":false, "autowidth":true, "scrollOffset":18, "cellLayout":5, "subGridWidth":20, "multiselectWidth":20, "gridview":false, "rownumWidth":25, "rownumbers":false, "pagerpos":"center", "recordpos":"right", "footerrow":false, "userDataOnFooter":false, "hoverrows":true, "altclass":"ui-priority-secondary", "viewsortcols":[ false, "vertical", true ], "resizeclass":"", "autoencode":false, "remapColumns":[], "ajaxGridOptions":{}, "direction":"ltr", "toppager":false, "headertitles":false, "scrollTimeout":40, "data":[], "_index":{}, "grouping":false, "groupingView":{ "groupField":[], "groupOrder":[], "groupText":[], "groupColumnShow":[], "groupSummary":[], "showSummaryOnHide":false, "sortitems":[], "sortnames":[], "summary":[], "summaryval":[], "plusicon":"ui-icon-circlesmall-plus", "minusicon":"ui-icon-circlesmall-minus" }, "ignoreCase":true, "cmTemplate":{}, "idPrefix":"", "recordtext":"Visualizzati {0} - {1} di {2}", "emptyrecords":"Nessun record da visualizzare", "loadtext":"Caricamento...", "pgtext":"Pagina {0} di {1}", "sortable":true, "useProp":true, "id":"find", "keyIndex":false, "localReader":{ "root":"rows", "page":"page", "total":"total", "records":"records", "repeatitems":false, "cell":"cell", "id":"id", "userdata":"userdata", "subgrid":{ "root":"rows", "repeatitems":true, "cell":"cell" } }, "width":1648, "tblwidth":1648, "disableClick":false, "_nvtd":[ 686, 20 ], "totaltime":54, "knv":null }})


Otherwise everything work as expected.

Notice that jsonstring data are exported and imported without any intervent.
Maybe a bug???

I use jqGrid 4.4.0 and jQuery 1.7.2 and jQuery UI 1.8.21.
For every test i'm here and thanky to all for all.
Mirko

06/08/2012
14:52
Avatar
HGWheels
New Member
Members
Forum Posts: 2
Member Since:
06/08/2012
sp_UserOfflineSmall Offline

Just wanted to throw my hat into this ring as well.  I am using jqGrid 4.4.0, jQuery 1.7.2, and jQuery UI 1.8.18. 

When using jqGridExport and jqGridImport the operation fails when there is filter data set.  I am doing

multipleSearch: true and multipleGroup: true in my config.  I can also confirm that when there are no filters

applied the string produced by jqGridExport is successfully imported by jqGridImport as one would expect. 

When a filter is applied then jqGridExport ceases to properly be imported by jqGridImport.  I am making sure to

unload the grid using jqGrid('GridUnload') before calling jqGridImport.  Also I am not changing/formatting the string

produced by jqGridExport in any way.  As posted by panciom above I receive the same error when trying to

perform the import "invalid property id".  For what it is worth I have tested this with jsonstring and xmlstring

and both produce the same error.  It would seem that the output of jqGridExport is not properly escaping

characters when multipleSearch and multipleGroup are both turned on.

06/08/2012
16:46
Avatar
HGWheels
New Member
Members
Forum Posts: 2
Member Since:
06/08/2012
sp_UserOfflineSmall Offline

I did some additional troubleshooting this morning and I think I have pinpointed the issue.

When the jqGridExport method is called and type jsonstring is used the "filters" section looks like this:

"filters":{"{"groupOp":"AND","rules":[{"field":"param1","op":"eq","data":"data1"},{"field":"param2","op":"cn","data":"data2"}]}"}

However the string should look like this:

"filters":"{"{"groupOp":"AND","rules":[{"field":"param1","op":"eq","data":"data1"},{"field":"param2","op":"cn","data":"data2"}]}"}"

Notice that the export function is not placing the filters inside of double quotes.  This is causing the jqGridSetParam method to try and interpret the '' escape characters.  Additionally if you were to remove the escape characters, then once the data is posted to the server the "filters" parameter is interpreted as json and is no longer valid.  We want the entire string posted to the server not the json structure.

I believe the offending lines from grid.import.js are 185 & 186:

   ret=ret.replace(/filters":"/,'filters":');
   ret=ret.replace(/}]}"/,'}]}');

I temporarily resolved the problem by doing a search/replace on the jqGridExport jsonstring with the following:

s/"filters":{/"filters":"{/gi

s/"}]}/"}]}"/gi

Someone with more experience with the jqGrid structure may need to make/advise on the source fix to resolve this issue.

24/10/2012
15:18
Avatar
Panciom
Italia
New Member
Members
Forum Posts: 2
Member Since:
18/07/2012
sp_UserOfflineSmall Offline

How can i tell jqgrid developer about this bug?

Can someone help me/us?

This evening will try jqgrid 4.4.1 to see if the problem is still there.

Thank you to everyone and in particular HGWheels for give me a simple and fast solutions. 


Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
36 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information