“Can enableLocking be set dynamically on an Ext JS grid?”可以动态设置在Ext JS表格上吗?

huangapple go评论89阅读模式
英文:

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 &lt; columns.length; i++) {
   normalGrid.headerCt.moveAfter(columns[i], (columns[i - 1] || null));
}
normalGrid.headerCt.resumeLayouts(true);

huangapple
  • 本文由 发表于 2023年5月29日 18:52:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76356709.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定