英文:
Can enableLocking be set dynamically on an Ext JS grid?
问题
我在想是否可以在网格上动态启用列锁定?
我有一个网格,在按下按钮时,我可以动态重新排列列,使用 moveAfter
// 重新排序列
grid.headerCt.suspendLayouts();
for (var i = 0; i < columns.length; i++) {
grid.headerCt.moveAfter(columns[i], (columns[i - 1] || null));
}
grid.headerCt.resumeLayouts(true);
然而,如果我在网格上将 enableLocking
设置为 true
,当我点击按钮时,所有列都会消失,但实际上不会引发错误,这使问题难以排查。因此,我在移动列之前想知道是否可以禁用锁定。有人知道是否可以这样做吗?
谢谢您提前的帮助。
英文:
I am wondering whether it is possible to enable column locking on a grid dynamically at all?
I have a grid where I am able to rearrange columns dynamically when a button is pressed using moveAfter
// Reorder columns
grid.headerCt.suspendLayouts();
for (var i = 0; i < columns.length; i++) {
grid.headerCt.moveAfter(columns[i], (columns[i - 1] || null));
}
grid.headerCt.resumeLayouts(true);
However, if I set enableLocking
on the grid to true
, when I hit the button, all the columns disappear, but no error is actually raised, which makes the problem hard to troubleshoot. Therefore, I was thinking I could disable locking beforing moving the columns. Does anybody know whether one can do that?
Thank you in advance.
答案1
得分: 1
以下是翻译好的部分:
"What worked was to run the code above on the part of the grid that is not locked, that is"
"运行上面的代码的有效方法是在未锁定的网格部分运行,即"
var normalGrid = grid.normalGrid;
// Reorder columns
normalGrid.headerCt.suspendLayouts();
for (var i = 0; i < columns.length; i++) {
normalGrid.headerCt.moveAfter(columns[i], (columns[i - 1] || null));
}
normalGrid.headerCt.resumeLayouts(true);
英文:
What worked was to run the code above on the part of the grid that is not locked, that is
var normalGrid = grid.normalGrid;
// Reorder columns
normalGrid.headerCt.suspendLayouts();
for (var i = 0; i < columns.length; i++) {
normalGrid.headerCt.moveAfter(columns[i], (columns[i - 1] || null));
}
normalGrid.headerCt.resumeLayouts(true);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论