jqGrid v4.3.2
ie9
win7企业版
我正在使用以下代码生成子网格:
http://www.trirand.com/blog/jqgrid/jqgrid.html -> 高级 -> 网格作为子网格
我这样做,我有
1 级子网格OK
2 级子网格OK
3 级子网格OK
4 级子网格它为 3rd Lvl sg 的每一行加载子网格 OK,但它只显示 3rd Lvl sg 的第一行 id 的数据
当我检查开发人员工具时,我看到请求总是发送第三个子网格的第一行的 id,我知道如何将自定义参数附加到我已经尝试过的 postData 以及 Oleg K postData for subgrid in jqgrid不工作?(这在我的情况下不起作用,数据未添加到请求中)
我试图从以下事件中返回 rowdid 但没有运气,它仍然返回第三个子网格的第一行 id,因此,对于第三个子网格上的每一行,子子网格总是返回相同的。
subGridRowExpanded //always returns first row id of the third grid
onSelectRow //doesn't fire if we click the + icon for expanding the subgrid
beforeSelectRow //doesn't fire at all
另一个奇怪的行为是,如果我单击第三级子网格上的任何行,它只会选择第一行。
不,抱歉,不能使用 treegrid。
我正在考虑在第三级子网格的每一行的加号图标(第一个单元格)上绑定一个单击事件并触发一个 expandSubGridRow,但问题仍然存在,如何获取我单击的第三级的行的 rowid子网格?
最好的问候和提前感谢,非常感谢任何帮助。
jQuery("#listsg11").jqGrid({
url:'server.php?q=1',
datatype: "xml",
height: 190,
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90},
{name:'name',index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:8,
rowList:[8,10,20,30],
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id;
subgrid_table_id = subgrid_id+"_t";
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"subgrid.php?q=2&id="+row_id,
datatype: "xml",
colNames: ['No','Item','Qty','Unit','Line Total'],
colModel: [
{name:"num",index:"num",width:80,key:true},
{name:"item",index:"item",width:130},
{name:"qty",index:"qty",width:70,align:"right"},
{name:"unit",index:"unit",width:70,align:"right"},
{name:"total",index:"total",width:70,align:"right",sortable:false}
],
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id2, row_id2) {
var subgrid_table_id2;
subgrid_table_id2 = subgrid_id2+"_t";
$("#"+subgrid_id2).html("<table id='"+subgrid_table_id2+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id2).jqGrid({
url:"subgrid.php?q=3&id="+row_id2,
datatype: "xml",
colNames: ['No','Item','Qty','Unit','Line Total'],
colModel: [
{name:"num",index:"num",width:80,key:true},
{name:"item",index:"item",width:130},
{name:"qty",index:"qty",width:70,align:"right"},
{name:"unit",index:"unit",width:70,align:"right"},
{name:"total",index:"total",width:70,align:"right",sortable:false}
],
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id3, row_id3) {
var subgrid_table_id3;
subgrid_table_id3 = subgrid_id3+"_t";
$("#"+subgrid_id3).html("<table id='"+subgrid_table_id3+"' class='scroll'></table></div>");
jQuery("#"+subgrid_table_id3).jqGrid({
url:"subgrid.php?q=4&id="+row_id3,
datatype: "xml",
colNames: ['No','Item','Qty','Unit','Line Total'],
colModel: [
{name:"num",index:"num",width:80,key:true},
{name:"item",index:"item",width:130},
{name:"qty",index:"qty",width:70,align:"right"},
{name:"unit",index:"unit",width:70,align:"right"},
{name:"total",index:"total",width:70,align:"right",sortable:false}
]
});
}
});
}
});
}
});