gpt4 book ai didi

jqGrid,一次只显示一个子网格

转载 作者:行者123 更新时间:2023-12-02 04:51:24 25 4
gpt4 key购买 nike

我正在使用 jqGrid,我不能同时有 2 个子网格,如果单击第二个,则应关闭前一个。

而且我找不到一个事件来阻止这个...我需要这样的东西:

$("#list2").jqGrid({
multiSubGrids: false
});

也许这是我遗漏的东西......

enter image description here

提前致谢!

最佳答案

我找到了这种方式...它有效,但我不知道它是否是最好的方式:

// this will save the rowId of the previous subGrid
var previousRowId = 0;

$("#list2").jqGrid({
// all your default mapping here..
...
subGridRowExpanded: function (subgrid_id, row_id) {
if (previousRowId != 0) {
$(this).collapseSubGridRow(previousRowId);
}
...
// all your subgrid code here
...
// this will save the actual row_id,
// so the next time a subgrid is going to be expanded,
// it will close the previous one
previousRowId = row_id;
});

希望对其他人有帮助!

关于jqGrid,一次只显示一个子网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18769849/

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