我有一个 colModel 列,当用户按下按钮时,它将删除该行。但是,我需要将其转到服务器(确实如此)并使用行的 ID 将其从数据库中删除。
这是执行此操作的代码
colModel: [
...
{ name: 'id', index: 'Id', width: 70, hidden: true, editable: true,
{
name: 'actions', index: 'actions', width: 20, sortable: false, editable: false, formatter: imageFormat,
formatoptions: {
keys: true,
editbutton: false,
// I need to pass id from above into the server....this is what should happen here
delOptions: { url: Controller + 'Action?paramenter=' + id}
}
},
],
问题是我需要获取 id 列的值并将其传递到上面的参数中。
如何做到这一点?
谢谢
最佳答案
好吧,我没有使用 delOptions
我在 onSelectRow
属性中使用了 .jqGrid('delGridRow')
方法,
并获取我使用的 ID..
var myGrid = $('#grid'),
selRowId = myGrid.jqGrid('getGridParam', 'selrow'),
celValue = myGrid.jqGrid('getCell', selRowId, 'name');
所以所以...
jQuery("#resume").jqGrid('delGridRow', id, { height: 480, width: 400, closeAfterAdd: true, closeAfterEdit: true, recreateForm: true,url: Controller + 'Action?paramenter=' + celValue });
关于javascript - jqGrid获取单元格数据到delOptions属性中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27191150/