jqgrid中subgrid的postData无法正常工作? [英] postData for subgrid in jqgrid not working?
问题描述
我有一个带有子网格的jqgrid,它调用一个servlet. 我正在使用POST将一些数据发送到servlet,但是在调用子网格时不会发送相同的数据.这是我的JS:
Hi I have a jqgrid with a subgrid which calls into a servlet. I am sending some data to the servlet using POST but the same data doesn't get sent when the call for the subgrid is made. This is my 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吗? 谢谢.
So how can I postData also to the subgrid servlet? is there any way to specify subgridPostData? Thanks.
推荐答案
我发现subgridPostData
的建议很好.可能您应该在 trirand论坛中发布相应的功能请求.
I find the suggestion with subgridPostData
good. Probably you should post the corresponding feature request in the trirand forum.
现在,您可以使用 serializeSubGridData 事件本身来实现相同的功能.只需使用您喜欢的名称(例如subgridPostData
)定义一个新的jqGrid参数,然后在您的
Now you can implement the same feature itself using serializeSubGridData event. Just define a new jqGrid parameter with the name which you like, for example subgridPostData
and use it inside of your serializeSubGridData event handler:
$("#testsTable").jqGrid({
...
subGrid: true,
subGridUrl: "GetCurrentStatusServlet",
subgridPostData: {foo: "bar"},
serializeSubGridData: function(postdata) {
return $.extend(postdata, this.p.subgridPostData);
},
...
});
这篇关于jqgrid中subgrid的postData无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!