禁用所选jqGrid行的子网格扩展 [英] Disable subgrid expansion for selected rows of jqGrid
问题描述
问题:jqGrid有子网格。我想为主网格的某些行禁用展开/折叠功能。
Problem: jqGrid with subgirds. I want to disable the expand/collapse functionality for some rows of the main grid.
推荐答案
我实际上找到了一种方法:
I actually found a way:
grid.jqGrid('setGridParam',{
afterInsertRow: function(rowid, aData, rowelem) {
var rowData = grid.getRowData(rowid);
if(**Condition**){
$('tr#'+rowid, grid)
.children("td.sgcollapsed")
.html("")
.removeClass('ui-sgcollapsed sgcollapsed');
}
}
});
有一点问题。代码@Frank删除了图标,但仍然触发了点击事件。尝试取消绑定点击事件似乎不起作用,可能是因为它稍后附加(可能在 gridComplete 上)。无论如何,我认为click事件是使用'ui-sgcollapsed sgcollapsed'类之一附加的,因此如果你删除它们,则不会附加事件。
There was a bit of a problem. The code @Frank removed the icon, but the 'click' event was still triggered. Trying to unbind the 'click' event doesn't seem to work, probably because it is attached later on ( maybe on gridComplete). Anyway, I figured that the click event is attached using one of the 'ui-sgcollapsed sgcollapsed' classes, so if you remove them, the event won't be attached.
希望它有所帮助。
这篇关于禁用所选jqGrid行的子网格扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!