JQGrid删除行不会删除子网格

Tim*_*ott 3 jqgrid

我在jqGrid中删除了一行,如下所示:

elem.jqGrid('delRowData', rowid);
Run Code Online (Sandbox Code Playgroud)

但是与此行关联的子网格仍然存在.还有什么其他聪明的事情可以使整行(包括子网格)消失?

Ole*_*leg 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.
Run Code Online (Sandbox Code Playgroud)