postData for subgrid in jqgrid not working?
Asked Answered
P

1

5

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.

Pyrrhotite answered 15/12, 2010 at 10:55 Comment(0)
A
5

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);
    },
    ...
});
Apologete answered 15/12, 2010 at 11:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.