jqgrid 自定义删除对话框消息

2022-01-19 00:00:00 jquery javascript jqgrid

我想自定义删除对话框消息.基于选定的行?我想显示类似删除选定行:$selectedRow.columnValue?"的消息我该怎么做?

解决方案

你可以使用 或 getCell 从删除行中获取一些信息.

已更新:有关更多信息,请参阅答案.

I want to customize the delete dialog message. Based on a selected row? I want to display a message something like "Delete selected row: $selectedRow.columnValue? " How can i do that?

解决方案

You can use beforeShowForm or afterShowForm of the delGridRow to overwrite the text of the conformation dialog.

For example

beforeShowForm: function ($form) {
    $("td.delmsg", $form[0]).html("Do you really want delete the row with <b>id=" +
         $("#list").jqGrid('getGridParam','selrow') + "</b>?");
}

(see the old demo) will display the confirmation dialog like the following:

You can easy modify the example to display any other information about the deleting row. You can use getRowData or getCell to get some information from the deleting row.

UPDATED: See the answer for additional information.

相关文章