JQGrid Delete Row Does Not Delete Subgrid
I delete a row in a jqGrid like so:
elem.jqGrid('delRowData', rowid);
But the subgrid associated to this row remains. 开发者_运维技巧 What other clever thing do I need to do to make the whole row (including subgrid) go away?
You can do instead of the code which you posted the following:
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.
This seems to work:
elem.jqGrid('collapseSubGridRow', rowid);
elem.jqGrid('delRowData', rowid);
Umm, okay.
精彩评论