3
我删除一行在jqGrid的像这样:的jqGrid删除行不删除次网格
elem.jqGrid('delRowData', rowid);
但关联到该行次网格依然存在。为了使整行(包括子网格)消失,我还需要做哪些其他聪明的事情?
我删除一行在jqGrid的像这样:的jqGrid删除行不删除次网格
elem.jqGrid('delRowData', rowid);
但关联到该行次网格依然存在。为了使整行(包括子网格)消失,我还需要做哪些其他聪明的事情?
这似乎工作:
elem.jqGrid('collapseSubGridRow', rowid);
elem.jqGrid('delRowData', rowid);
嗯,还好。
你可以做的,而不是你贴下面的代码:
var selRow = $('#'+rowid), // get the row (<tr> element having id=rowid)
nextRow = selRow.next(); // get the next row
if (nextRow.hasClass('ui-subgrid')) {
// if the next row is a subgrid one should remove it
nextRow.remove();
}
elem.jqGrid('delRowData', rowid);
// the call of delRowData is better as just selRow.remove();
// because it change "records" and "reccount" parameters and
// change parameters "selrow" and "selarrrow" in case that
// the deleted row was selected.
使用这种方法,如果你有设置为“假”的reloadOnExpand选项,子网格行会留在网格中,虽然隐藏,并且不会被删除。 – Schmuli