且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jqGrid colmodel更改loadComplete

更新时间:2023-12-05 13:08:16

不会消失的"Loading ..."通常表示在填充网格或执行某些回调函数(例如loadComplete)期间发生了异常. .在这种情况下,错误是您使用jQuery("#listU05").jqGrid.setColProp而不是jQuery("#listU05").setColPropjQuery("#listU05").jqGrid('setColProp', ....

The "Loading..." which is not disappear means typically that an exception occur during of the filling of the grid or executing some callback functions like loadComplete. In you case the error was that you use jQuery("#listU05").jqGrid.setColProp instead of jQuery("#listU05").setColProp or jQuery("#listU05").jqGrid('setColProp', ....

您可以使用loadComplete的代码

loadComplete: function(data) {
    $(this).jqGrid('setColProp', 'Thema', {
        stype: 'select',
        searchoptions: {
            value:"a:a;b:b"
        }
    });
}

我建议您另外考虑使用beforeProcessing进行此类操作.如果设置colModel的搜索属性不是很重要,但是如果要使用格式化程序:选择" 并从服务器加载editoptions.value,然后正确使用beforeProcessing.从服务器返回的数据尚未处理.因此,您可以更改 editoptions value属性,并已经在当前数据处理期间value属性rel ="nofollow">编辑选项将由'select'格式化程序使用.

I recommend you additionally to consider to use beforeProcessing for such operations. In case of setting searching properties of colModel it is not really important, but if you want use formatter:'select' and load the editoptions.value from the server then usage of beforeProcessing is exactly correct place. The data returned from the server are not yet processed. So you can change value property of editoptions and already during the current processing of the data the value property of editoptions will be used by 'select' formatter.