【问题标题】:JQGrid: local - jqGrid.trigger("reloadGrid") makes formatted data disappearJQGrid: local - jqGrid.trigger("reloadGrid") 使格式化数据消失
【发布时间】:2013-09-24 05:59:18
【问题描述】:

我有一个 JQGrid 并使用 loadonce: true

添加过滤器并调用reloadGrid时。

带有自定义格式化程序的单元格不会显示数据。在这种情况下,它们是单选按钮。

请问我该如何解决这个问题?

当它检查单元格时.. 数据为空。并且在 reloadGrid 期间没有调用格式化程序

【问题讨论】:

  • 您是否同时定义了 Format 和 UnFormat 函数?
  • 只有格式化程序:formatRadio

标签: jquery jqgrid


【解决方案1】:

你可能还应该设置一个 unformat 函数,根据您的单选按钮选择状态,您返回作为数据传递给 JQgrid 的原始值(我假设它是布尔值) 它可能是这样的:

 function unformatRadio(cellValue, options, cellObject) 
    {
        return $(cellObject).is(":checked");
    }

这将确保您在处理数据时使用原始数据而不是格式化的数据

Jqgrid Custom Formatter

编辑:

我想这里是 solution 来解决你的问题。

【讨论】:

  • 我试过这样做,但在调用“reloadGrid”时没有调用它
  • @user4127:我同意 AlexAr 的观点,即由于缺少 unformat 函数或在 colModel 中错误使用 index 属性而存在数据“消失”的典型问题。您应该在您使用的 JavaScript 代码中附加您的问题
猜你喜欢
  • 2014-11-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-10
  • 2011-07-20
  • 1970-01-01
相关资源
最近更新 更多