javascript - jqGrid modal edit save only changed data and marked edited row? -
i use jqgrid 4.9.3-pre - free jqgrid oleg. edit data using model window "form editing". data server. datatype: "json" loadonce: false, paging of data don't use use standard table. call "form editing" ondblclickrow.
ondblclickrow: function(rowid) { $(this).jqgrid('setselection', rowid) .jqgrid("editgridrow", rowid, { recreateform: true, width: 1000, height: "auto"}); }
two questions:
i find question interesting , created the demo, demonstrates 1 of possible implementation of making edited field of form editing. results looks on picture below
the corresponding code inside of beforeshowform
callback:
beforeshowform: function ($form) { var $self = $(this), mymarker = "<span class='mychanged-item fa fa-lg fa-arrow-circle-o-left' style='display:none;border-radius:6px;background-color:lightgreen;'></span>"; $form.find(".formelement").focusout(function () { var colname = $(this).attr("name"), rowid = $form.find("input[name='" + $self[0].id + "_id" + "']") .val(), oldvalue = $self.jqgrid("getcell", rowid, colname), $mymarker = $(this).closest("td") .next("td") .find("span.mychanged-item"); if ($(this).val() !== oldvalue) { $mymarker.css("display", ""); // show } else { $mymarker.css("display", "none"); // hide } }).each(function () { $(this).closest("td") .after("<td style='width:15px'>" + mymarker + "</td>"); }); }
Comments
Post a Comment