jqgrid inline edit - Save handler when clicking enter
Im wondering if there is an event handler for the save method when clicking enter to save the row. I want to use it to hide the row from the grid after being saved.
tha开发者_如何学Gonks in advance!
Both editRow and saveRow inline editing methods has succesfunc
and aftersavefunc
parameters which you can use. The aftersavefunc
has small advantage because it is used in both local and remote holding of the grid data. So the code can be
ondblClickRow: function (rowid) {
$(this).jqGrid('editRow', rowid, true, null, null, null, {}, function (rowid) {
$(this.rows.namedItem(rowid)).hide();
$(this).focus(); // set focus somewhere
});
}
See the corresponding demo here.
The only thing which you should not forget is that the modified rows will be hidden, but not deleted and the row could be visible on the next grid refresh. Try to sort the rows on the demo or go to the next page and back. If you hold the data remotely and on refreshing of data will be implemented on the server side, the server should just not send the hidden rows to jqGrid. Probably the usage of delRowData could be better in your caee. The method delete the data from the local grid, but send no delete request to the server.
精彩评论