jqGrid子网格不扩展

发布于 2024-11-06 20:40:43 字数 2962 浏览 0 评论 0原文

我按照 www.trirand.com/blog/jqgrid/jqgrid.html 中所示的方式进行操作,

但子网格未展开

这是我的 jqgrid 代码:

 jQuery("#list").jqGrid({
            url:"../ajax_request/user_table_request.php",
            datatype: "json",
            mtype : "post",
            autoheight:true,
            autowidth:true,
            colNames:[
                "Kode Jabatan Pengguna",
                "Id Pengguna",
                "Username",
                "Nama Pengguna",
                "Email",
                "Id Jabatan",
                "Nama Jabatan"
            ],
            colModel:[
                {
                    name:"id",
                    index:"kode_jabatan",
                    align: "center",
                    width:15,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },

                {
                    name:"id_pengguna",
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    width:20,
                    editable:false,
                    editoptions:{readonly:true,size:20},
                    hidden:false
                },
                {
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    name:"id_jabatan",
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                }
            ],
            rowNum:10,
            rowList:[10,20,30,40,50,60,70,80,90,100],
            pager: '#pager',
            sortname: 'kode_jabatan',
            sortorder: "asc",
            subGrid : true,
            subGridUrl: '../ajax_request/grid_jabatan_request.php',
            subGridModel: [
                {
                    name : ['Id Jabatan','Jabatan'],
                    width : [55,200],
                    params:['kode_jabatan']
                }
            ],
            scrollbar: true
        });
        jQuery("#list").jqGrid('navGrid','#pager',{edit:true,add:false,del:false,search:false});
        jQuery("#list").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:80, maxHeight:350});

我做错了什么? 有人有什么想法吗?

我混淆了 subgrid.js 和 grid.subgrid.js 它们是相同的吗?

I've followed the way shown in www.trirand.com / blog / jqgrid / jqgrid.html

but the subgrid was not expanded

This is my jqgrid code:

 jQuery("#list").jqGrid({
            url:"../ajax_request/user_table_request.php",
            datatype: "json",
            mtype : "post",
            autoheight:true,
            autowidth:true,
            colNames:[
                "Kode Jabatan Pengguna",
                "Id Pengguna",
                "Username",
                "Nama Pengguna",
                "Email",
                "Id Jabatan",
                "Nama Jabatan"
            ],
            colModel:[
                {
                    name:"id",
                    index:"kode_jabatan",
                    align: "center",
                    width:15,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },

                {
                    name:"id_pengguna",
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    width:20,
                    editable:false,
                    editoptions:{readonly:true,size:20},
                    hidden:false
                },
                {
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    name:"id_jabatan",
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                },
                {
                    width:10,
                    editable:false,
                    editoptions:{readonly:true,size:10},
                    hidden:false
                }
            ],
            rowNum:10,
            rowList:[10,20,30,40,50,60,70,80,90,100],
            pager: '#pager',
            sortname: 'kode_jabatan',
            sortorder: "asc",
            subGrid : true,
            subGridUrl: '../ajax_request/grid_jabatan_request.php',
            subGridModel: [
                {
                    name : ['Id Jabatan','Jabatan'],
                    width : [55,200],
                    params:['kode_jabatan']
                }
            ],
            scrollbar: true
        });
        jQuery("#list").jqGrid('navGrid','#pager',{edit:true,add:false,del:false,search:false});
        jQuery("#list").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:80, maxHeight:350});

what am I doing wrong?
Anybody have any ideas?

I confused subgrid.js and grid.subgrid.js are they same?

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

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

发布评论

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

评论(2

烂柯人 2024-11-13 20:40:43
  1. 您应该为 jqGrid 的所有列定义 name 属性。目前 7 列中的 4 列没有名称
  2. 您不应在 colModelsubGridModelname 属性中使用空格。您当前在 subGridModelname 属性中使用'Id Jabatan'
  3. 子网格的数据将通过 subGridUrl 参数定义的 url 提供。您应该验证它是否收到请求并使用正确的 JSON 数据进行应答。
  1. You should define name property for all columns of jqGrid. Currently 4 from 7 columns has no name.
  2. You should not use blanks in the name property of colModel or subGridModel. You use currently 'Id Jabatan' in the name property of subGridModel.
  3. The data for the subgrid will be provided by url defined by subGridUrl parameter. You should verify that it receive the request and answer with crrect JSON data.
鹿童谣 2024-11-13 20:40:43

当主网格加载时,所有子网格将自动展开,代码如下:

 subGridOptions: {
    "plusicon"  : "ui-icon-triangle-1-e",
    "minusicon" : "ui-icon-triangle-1-s",
    "openicon"  : "ui-icon-arrowreturn-1-e",
    "expandOnLoad" : true,
    "reloadOnExpand" : true,
    "selectOnExpand" : true

},

When the main grid loads, all the subgrids will automatically be expanded with the following code:

 subGridOptions: {
    "plusicon"  : "ui-icon-triangle-1-e",
    "minusicon" : "ui-icon-triangle-1-s",
    "openicon"  : "ui-icon-arrowreturn-1-e",
    "expandOnLoad" : true,
    "reloadOnExpand" : true,
    "selectOnExpand" : true

},

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文