jqgrid inline edit - Save handler when clicking enter

非 Y 不嫁゛ 提交于 2019-12-08 06:32:03

问题


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.

thanks in advance!


回答1:


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.



来源:https://stackoverflow.com/questions/7126810/jqgrid-inline-edit-save-handler-when-clicking-enter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!