【问题标题】:postData for subgrid in jqgrid not working?jqgrid中子网格的postData不起作用?
【发布时间】:2011-05-25 20:22:51
【问题描述】:

您好,我有一个带有子网格的 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? 谢谢。

【问题讨论】:

    标签: jquery jqgrid subgrid


    【解决方案1】:

    我发现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);
        },
        ...
    });
    

    【讨论】:

      猜你喜欢
      • 2015-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多