【发布时间】:2011-03-21 16:45:53
【问题描述】:
我有一个带有子网格的 jqgrid。如何在不点击加号的情况下展开子网格?
我遇到了$("#jqgrid_id").expandSubGridRow(rowId);,但不确定使用哪个 rowId 来扩展子网格。
谢谢。
【问题讨论】:
我有一个带有子网格的 jqgrid。如何在不点击加号的情况下展开子网格?
我遇到了$("#jqgrid_id").expandSubGridRow(rowId);,但不确定使用哪个 rowId 来扩展子网格。
谢谢。
【问题讨论】:
在网格的 onSelectRow 事件中使用$("#jqgrid_id").expandSubGridRow(rowId);。
类似这样的:
jQuery("#jqgrid_id").jqGrid({
...
onSelectRow: function(rowId){
$("#jqgrid_id").expandSubGridRow(rowId);
},
...
});
已编辑:在 GridComplete 事件中
jQuery("#jqgrid_id").jqGrid({
...
gridComplete: function(){
var rowIds = $("#jqgrid_id").getDataIDs();
$.each(rowIds, function (index, rowId) {
$("#jqgrid_id").expandSubGridRow(rowId);
});
},
...
});
【讨论】:
将 getDataIds() 更改为 getDataIDs()!
【讨论】: