开发者

jqgrid click local data column sort (client-side only) wipes userData on grid refresh

开发者 https://www.devze.com 2023-04-11 01:33 出处:网络
I have a grid that is populated by a JSON response (MVC3 controller) that has a userData c开发者_JAVA百科omponent for some additional data for grid captions, etc.All that works just fine.I recently sw

I have a grid that is populated by a JSON response (MVC3 controller) that has a userData c开发者_JAVA百科omponent for some additional data for grid captions, etc. All that works just fine. I recently switched the the grid's data loading to "loadonce: true" as in working with larger grid results sets, I wanted client-side sorting and filtering. All that works good. BUT, I was surprised that the userData got wiped the first time I clicked any column for sorting. If I turn off loadonce, userData is fine, but it is of course going back to the server each time. The items that make use of the userData fire on gridcomplete and are now coming back "undefined" after a sort (and probably anything that reloads the grid). Any thoughts why this might be happening? Oh yeah, I also noticed that clicking a column sort wiped out any multiselections (perhaps related to the same culprit?).

Thanks,

Mark


You are right. +1 from me. It's a jqGrid bug. Inside of internal addLocalData method after the line 1527 of the file grid.base.js of jqGrid 4.1.2 or after the 1532 of jquery.jqGrid.src.js (you can get modified version from here) one should add the following line

retresult[ts.p.localReader.userdata] = ts.p.userData;

It will fix the problem. I posted the corresponding bug report here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号