Skip to content Skip to sidebar Skip to footer

How To Update Column On Other Column Change In Inline Edit

Free jqgrid contains 3 columns: Price, Quantity and Sum. html5 number input type is used. If Sum column is changed in inline edit, Price column value should calculated using formu

Solution 1:

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
            }
        }]
    }
};

One can use now template: "mySum":

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

instead of template: sumColumnTemplate:

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

Post a Comment for "How To Update Column On Other Column Change In Inline Edit"