日期:2014-05-16  浏览次数:20418 次

Grid作为Subgrid,子grid如何分页?
哪位大神提供一下demo
多谢啦

------解决方案--------------------
grid作为subgrid的时候,配置和基础grid一样,增加pager配置就行了,需要往subgrid的容器中添加pager的容器

var subgrid_table_id;
       subgrid_table_id = subgrid_id+"_t";
       jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='pager"+subgrid_id+"'></div>");
       jQuery("#"+subgrid_table_id).jqGrid({
          url:"subgrid.php?q=2&id="+row_id,
          datatype: "xml",
          colNames: ['No','Item','Qty','Unit','Total'],
          colModel: [
            {name:"num",index:"num",width:80,key:true},
            {name:"item",index:"item",width:130},
            {name:"qty",index:"qty",width:80,align:"right"},
            {name:"unit",index:"unit",width:80,align:"right"},           
            {name:"total",index:"total",width:100,align:"right",sortable:false}
          ],
          height: '100%',
          rowNum:20,
          sortname: 'num',
          sortorder: "asc",
          pager: "pager"+subgrid_id
       });