我按照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是否相同?
答案 0 :(得分:0)
name
属性。目前,7列中有4列没有name
。name
或colModel
的{{1}}属性中使用空格。您目前在subGridModel
的{{1}}属性中使用'Id Jabatan'
。name
参数定义的网址提供。您应该验证它是否收到请求并使用正确的JSON数据进行回答。答案 1 :(得分:0)
当主网格加载时,将使用以下代码自动扩展所有子网格:
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
},