【发布时间】:2013-11-19 21:51:25
【问题描述】:
实际上,我已经实现了一个 REST 解决方案,用于从 jQGrid 上的 NavGrid POST、PUT 和 DELETE 数据。
现在在每一行的操作按钮中,我尝试做同样的事情,但我不知道如何在默认格式化程序操作上生成动态 url。
我试试这个:
colModel : [
{name:'actions', index:'', width:80, fixed:true, sortable:false, resize:false,
formatter:'actions',
formatoptions:{
url: function(cellValue, rowId, rowData){
return restPutURL + '/' + rowId ;
},
mtype: 'PUT',
keys:true,
delOptions:{
url: restDelURL,
recreateForm: true,
beforeShowForm:beforeDeleteCallback,
onclickSubmit :function(params, postdata) {
params.url += '/' + postdata;
}
}
}
},
{ ...my cols.. }
]
删除操作没问题,但编辑不起作用。当保存一行时,jQGrid 发送函数作为 URI 的一部分:
system/function%20(cellValue,%20rowId,%20rowData)%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20console.log(cellValue);%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20/system/function%20(cellValue,%20rowId,%20rowData)%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
如何创建动态 URI?或者,如何将已编辑行的 id 添加到 URI?
【问题讨论】: