我在jqGrid中删除了一行,如下所示:
elem.jqGrid('delRowData', rowid);
但与此行关联的子网格仍然存在。我还需要做些什么来使整行(包括子网格)消失?
答案 0 :(得分:5)
您可以代替发布以下内容的代码:
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.
答案 1 :(得分:2)
这似乎有效:
elem.jqGrid('collapseSubGridRow', rowid);
elem.jqGrid('delRowData', rowid);
嗯,好的。