嗨,我有一个带有子网格的 jqgrid,它调用 servlet。 我使用 POST 向 servlet 发送一些数据,但在调用子网格时不会发送相同的数据。这是我的 JS:
$("#testsTable").jqGrid({
mtype: "POST",
url: "GetCurrentStatusServlet",
postData: {buildPath :"C:\\Test\\01"},
datatype: "xml",
colNames:['TestCase Name', 'Last Update', 'Status'],
colModel:[
{name:'name',index:'name', width:90},
{name:'lastupdate',index:'lastupdate', width:100},
{name:'status',index:'status', width:80, align:"right"}
],
rowNum:10,
autowidth: true,
rowList:[10,20,30],
pager: $('#pager1'),
sortname: 'id',
viewrecords: true,
multiselect: true,
caption: "Tests",
sortorder: "desc",
subGrid: true,
subGridUrl : "GetCurrentStatusServlet",
subGridModel: [ {
name: ['TestCase Name', 'Last Update', 'Status'],
width : [100, 200, 80],
params: ['name']}]
}).navGrid('#pager1',{edit:false,add:false,del:false});
那么我怎样才能将数据也发布到子网格 servlet 中呢?有什么方法可以指定subgridPostData吗? 谢谢。
最佳答案
我发现 subgridPostData
的建议很好。也许您应该在 trirand forum 中发布相应的功能请求.
现在您可以使用 serializeSubGridData 实现相同的功能本身事件。只需使用您喜欢的名称定义一个新的 jqGrid 参数,例如 subgridPostData
并在 serializeSubGridData 中使用它。事件处理程序:
$("#testsTable").jqGrid({
...
subGrid: true,
subGridUrl: "GetCurrentStatusServlet",
subgridPostData: {foo: "bar"},
serializeSubGridData: function(postdata) {
return $.extend(postdata, this.p.subgridPostData);
},
...
});
关于jquery - jqgrid 中子网格的 postData 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4449130/