gpt4 book ai didi

JQGrid删除行不删除子网格

转载 作者:行者123 更新时间:2023-12-01 08:11:22 25 4
gpt4 key购买 nike

我像这样在 jqGrid 中删除一行:

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.

关于JQGrid删除行不删除子网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7181085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com