开发者

postData for subgrid in jqgrid not working?

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}); 

So how can I postData also to the subgrid servlet? is there any way to specify subgridPostData? Thanks.


I find the suggestion with subgridPostData good. Probably you should post the corresponding feature request in the trirand forum.

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);
    },
    ...
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜