JQGrid :作为带有导航栏的 GRID 的子网格

发布于 2024-09-24 08:05:22 字数 117 浏览 6 评论 0原文

我正在使用 JQGrid 并将 subGrid 显示为 JQGRID 本身。 我想知道是否有办法也显示子网格的导航栏。

我尝试按照 JQGrid 的方式进行操作,但没有成功。

提前致谢!

I am using JQGrid and displaying subGrid as a JQGRID itself.
I was wondering if there is a way to display the navigation bar for the subgrid too.

I tried following the way its being done for JQGrid, but in vain.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遥远的绿洲 2024-10-01 08:05:22

确保在 subGrid jqGRid 函数中,您还将分页器属性设置为子网格中的分页器 id

... subGrid: true,
            subGridRowExpanded: function(subgrid_id, row_id) 
            {
               var subgrid_table_id;
               var pager_id;
               subgrid_table_id = subgrid_id+"_t";
               pager_id = "p_"+subgrid_table_id;
               $("#" + subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+ pager_id +"' class='scroll'></div>");
               $("#" + subgrid_table_id).jqGrid({
                  url:"ListSub/"+ row_id,
                  datatype: "json",
                  colNames: ['Street1','Street2','Street3','Zip','Place','Country'],
                  colModel:
                  [
                    {name:"Street1",index:"Street1",width:80,key:true, editable:true},
                    {name:"Street2",index:"Street2",width:130, editable:true},
                    {name:"Street3",index:"Street3",width:80,align:"right", editable:true},
                    {name:"Zip",index:"Zip",width:80,align:"right", editable:true},           
                    {name:"Place",index:"Place",width:100,align:"right", editable:true},
                    {name:"Country",index:"Country",width:100,align:"right", editable:true}
                  ],
                  caption: "Offices",
                  height: "100%",
                  rowNum:10,
                  sortname: 'Street1',
                  sortorder: "asc",
                  pager:pager_id
               });
             jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false,search:false})
            }....

Make sure that in the subGrid jqGRid function you also set the pager property to the pager id in the subgrid

... subGrid: true,
            subGridRowExpanded: function(subgrid_id, row_id) 
            {
               var subgrid_table_id;
               var pager_id;
               subgrid_table_id = subgrid_id+"_t";
               pager_id = "p_"+subgrid_table_id;
               $("#" + subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+ pager_id +"' class='scroll'></div>");
               $("#" + subgrid_table_id).jqGrid({
                  url:"ListSub/"+ row_id,
                  datatype: "json",
                  colNames: ['Street1','Street2','Street3','Zip','Place','Country'],
                  colModel:
                  [
                    {name:"Street1",index:"Street1",width:80,key:true, editable:true},
                    {name:"Street2",index:"Street2",width:130, editable:true},
                    {name:"Street3",index:"Street3",width:80,align:"right", editable:true},
                    {name:"Zip",index:"Zip",width:80,align:"right", editable:true},           
                    {name:"Place",index:"Place",width:100,align:"right", editable:true},
                    {name:"Country",index:"Country",width:100,align:"right", editable:true}
                  ],
                  caption: "Offices",
                  height: "100%",
                  rowNum:10,
                  sortname: 'Street1',
                  sortorder: "asc",
                  pager:pager_id
               });
             jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false,search:false})
            }....
强辩 2024-10-01 08:05:22
subGrid: true,
subGridRowExpanded: function(ParentGridID, rowid) {
    var datagridSub, navGrid;
    SubGridID = ParentGridID+"_t";
    //alert(rowid);
    navGrid = "p_"+datagridSub;
    $("#"+ParentGridID).html("<table id='"+SubGridID+"' class='scroll'></table><div id='"+PagerID+"' class='scroll'></div>");
    jQuery("#"+SubGridID).jqGrid({
        url:'service url'+rowid,
        datatype: "json",
        type: "GET",
        colNames: ['Id','MID','VendorCode1','VendorCode2','Percentage'],
        width:700,
        colModel: [
            {name:"id",index:"id",width:30},
            {name:"mid",index:"mid",width:30},
            {name:"vendorcode1",index:"vendorcode1",width:40},
            {name:"vendorcode2",index:"vendorcode2",width:40},
            {name:"percentage",index:"percentage",width:70}
        ],
        jsonReader: {
            repeatitems: false,        // To Bind the Data in Grid, if it is JSON format.
            id: "id",
            root: function (obj) { return obj; }     // To Bind the Data in Grid.
            // page: function () { return 1; },
            //total: function () { return 1; },
            //records: function (obj) { return obj.length; },    
        },
        rowNum:20,
        pager: '#PagerID',
        sortname: 'num',
        sortorder: "asc",
        postData: {id: rowid},
        height: '120%',
    });
}
subGrid: true,
subGridRowExpanded: function(ParentGridID, rowid) {
    var datagridSub, navGrid;
    SubGridID = ParentGridID+"_t";
    //alert(rowid);
    navGrid = "p_"+datagridSub;
    $("#"+ParentGridID).html("<table id='"+SubGridID+"' class='scroll'></table><div id='"+PagerID+"' class='scroll'></div>");
    jQuery("#"+SubGridID).jqGrid({
        url:'service url'+rowid,
        datatype: "json",
        type: "GET",
        colNames: ['Id','MID','VendorCode1','VendorCode2','Percentage'],
        width:700,
        colModel: [
            {name:"id",index:"id",width:30},
            {name:"mid",index:"mid",width:30},
            {name:"vendorcode1",index:"vendorcode1",width:40},
            {name:"vendorcode2",index:"vendorcode2",width:40},
            {name:"percentage",index:"percentage",width:70}
        ],
        jsonReader: {
            repeatitems: false,        // To Bind the Data in Grid, if it is JSON format.
            id: "id",
            root: function (obj) { return obj; }     // To Bind the Data in Grid.
            // page: function () { return 1; },
            //total: function () { return 1; },
            //records: function (obj) { return obj.length; },    
        },
        rowNum:20,
        pager: '#PagerID',
        sortname: 'num',
        sortorder: "asc",
        postData: {id: rowid},
        height: '120%',
    });
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文