且构网

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

如何在内联编辑中更新其他列更改上的列

更新时间:2023-11-13 11:03:34

存在该问题是因为您将template属性与该对象用作值.从jqGrid 4.7开始(请参阅我的旧请求请求),可以定义标准"模板并在那里用作字符串.

The problem exist because you use template property with the object as the value. Starting with jqGrid 4.7 (see my old pull request) it's possible to define "standard" templates and to use there as strings.

需要使用以下代码进行定义

One need to use the following code to define

$.jgrid = $.jgrid || {};
$.jgrid.cmTemplate = $.jgrid.cmTemplate || {};
$.jgrid.cmTemplate.mySum = {
    editoptions: {
        type: "number", 
        dataEvents: [{
            type: "change",
            fn: function(e) {
                // some code
            }
        }]
    }
};

现在可以使用template: "mySum":

{"template":"mySum","label":"Sum","name":"Sum","width":80}

代替template: sumColumnTemplate:

{"template":sumColumnTemplate,"label":"Sum","name":"Sum","width":80,
"index":"Sum","hidden":false}