jqgrid单击本地数据列排序(仅客户端),在网格刷新时擦除userData [英] jqgrid click local data column sort (client-side only) wipes userData on grid refresh

查看:137
本文介绍了jqgrid单击本地数据列排序(仅客户端),在网格刷新时擦除userData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由JSON响应(MVC3控制器)填充的网格,该响应具有一个userData组件,用于网格标题等一些其他数据.一切正常.我最近将网格的数据加载切换为"loadonce:true",因为在处理较大的网格结果集时,我希望客户端进行排序和过滤.一切正常.但是,令我惊讶的是,我第一次单击任何列进行排序时,userData都被擦除了.如果我关闭loadonce,则userData可以,但是每次都可以返回到服务器.使用userData的项目在gridcomplete上触发,现在在排序后返回未定义"(可能是重新加载网格的任何内容).有什么想法可能会发生这种情况吗?哦,是的,我还注意到单击列排序会清除所有选择项(也许与同一个罪魁祸首有关?).

I have a grid that is populated by a JSON response (MVC3 controller) that has a userData component 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?).

谢谢

标记

推荐答案

您是对的.向我+1.这是一个jqGrid错误.在第1527行之后的内部addLocalData方法内部或jcGrid 4.1.2的文件grid.base.js或jquery.jqGrid.src.js的1532之后(您可以从

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.

这篇关于jqgrid单击本地数据列排序(仅客户端),在网格刷新时擦除userData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆