jquery - jqGrid compare pre and post cell or row editing values -


i need retrieve row content or cell content before editing can pass post data. need compare pre , post editing values , send them both database. code beforeedit cell not firing.

grid.jqgrid({     url         : url,     editurl     : updurl,     mtype       : "post",     postdata    : {'action':'wk','id':id},     datatype    : "json",     page        : 1,     regional    : lang,     beforeeditcell : getcellcurrentvalue,     idprefix    : "w_",     colnames    : wkcolname[lang],     colmodel    : [                     { name: 'id', width: 25, hidden: true },                     { name: 'c_id', key:true, editable: true, width: 20, editrules : { required: true, integer:true, minvalue:1} },                   ],     autowidth   : true,     height      : 445,     rownum      : 20,     caption     : gridcaption,     shrinktofit : true,     sortorder   : "asc",     hidegrid    : false,     gridview    : true,     pgbuttons   : false,     pgtext      : null,     viewrecords : false,     pager       : gridpager, }) .inlinenav(gridpager,{edit: true, add: true, del: false, cancel: true, refresh : false,                                 editparams: {keys: true,extraparam: {'action':'wk', 'id': id, 'oldwk' : oldwkvalue}},                                 addparams: {position: 'last',                                                 addrowparams:{                                                 keys:true,                                                 extraparam:{'action':'wk','id':id},                                                             successfunc: function () {                                                                 var $self = $(this);                                                                 settimeout(function () {                                                                     $self.trigger("reloadgrid");                                                                 }, 50);                                                             }                                                 }                                             }                             }); var lastwkselrowcontent; var oldwkvalue; function getcellcurrentvalue(id) {     if (id && id !== lastwkselrowcontent) {         oldweekvalue = grid.jqgrid('getcell',id,'id');         lastwkselrowcontent = id;         return oldwkvalue;     } } 

the easy way usage of beforesaverow change extraparam dynamically , add additional information, need. can include callback in editparams , addrowparams. first 2 parameters of beforesaverow callback options , rowid. options contains extraparam property, properties can extend of change. old row find inside of savedrow, parameter of jqgrid. think can find required information under savedrow[0].id.

beforesaverow: function (options, rowid) {     var p = $(this).jqgrid("getgridparam");     // modify extraparam     options.extraparam.oldwk = p.savedrow[0].id;     // exact 1 can search p.savedrow array     // item have p.savedrow[i].id === rowid,     // if 1 row editing @ same time     // array p.savedrow have 1 element ,     // p.savedrow[0] have old values: c_id , id     // , p.savedrow[0].id === rowid } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -