无法在可调整大小的网格中选择文本

发布于 2025-01-09 20:34:23 字数 378 浏览 2 评论 0原文

我需要具有可调整大小并允许用户选择单元格值的 Ext.panel.Grids (v6.2.0)。

我有一堆网格,我已将其设置为可调整大小:

resizable: {
    pinned: true,
    handles: 's'
}

现在的问题是,即使在表视图上进行覆盖......

Ext.override(Ext.view.Table, {
    enableTextSelection: true
})

我无法再选择网格内的文本。如果我删除调整网格大小,则允许我选择记录值以供稍后复制和粘贴。

我也尝试过覆盖该列的enableTextSelection,但这仍然不起作用。

I need to have Ext.panel.Grids (v6.2.0) that are both resizable and allow users to select the cell values.

I have a bunch grids that I've set to be resizable with:

resizable: {
    pinned: true,
    handles: 's'
}

the problem now, even with overrides on the Table view...

Ext.override(Ext.view.Table, {
    enableTextSelection: true
})

... I can no longer select the text within the grids. If I remove the resizing the grids allow me to select the record values to copy and paste later.

I've tried overriding the column's enableTextSelection, too, but that still didn't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流绪微梦 2025-01-16 20:34:23

我在网格的配置中添加了这个:

viewConfig: {
    enableTextSelection: true,
    getRowClass: function () {
        return this.enableTextSelection ? "x-selectable" : ''; // bugfix for ExtJs 6.2.0
    }
},

这将允许选择行。

II added this in the configuration of the grid:

viewConfig: {
    enableTextSelection: true,
    getRowClass: function () {
        return this.enableTextSelection ? "x-selectable" : ''; // bugfix for ExtJs 6.2.0
    }
},

This will allow to select the rows.

与之呼应 2025-01-16 20:34:23

这似乎有效的唯一方法是重写 Ext.resizer.Resizer 的“构造函数”。我尝试只包含需要更改的部分,但最终使用了整个构造函数(https://docs.sencha.com/extjs/6.2.0/classic/src/Resizer.js.html) 在我的覆盖中,并在末尾添加以下内容:

me.el.removeCls(unselectableCls)

并改变了为了安全起见,

handleEl = me[pos] = me.el.createChild({
    id: me.el.id + '-' + pos + '-handle',
    cls: Ext.String.format(handleCls, pos), //removed the unselectable class
    unselectable: 'off', //changed from 'on' to 'off'
    role: 'presentation'
});

下面的内容是强制网格的父 div 上的不可选择类并使整个 div 的内容不可选择。我尝试覆盖它的 CSS,并覆盖 Ext.column.Column 和 Ext.table.View,但这些都不起作用。

The the only way this seemed to work was to override Ext.resizer.Resizer's "constructor". I tried to just include the parts that needed to change, but I ended up using the whole constructor (https://docs.sencha.com/extjs/6.2.0/classic/src/Resizer.js.html) in my override and added the following at the end:

me.el.removeCls(unselectableCls)

and changed the following just to be safe:

handleEl = me[pos] = me.el.createChild({
    id: me.el.id + '-' + pos + '-handle',
    cls: Ext.String.format(handleCls, pos), //removed the unselectable class
    unselectable: 'off', //changed from 'on' to 'off'
    role: 'presentation'
});

something in here was forcing the unselectable class on the parent div of the grid and making the whole div's contents unselectable. I tried overriding it CSS, and overriding the Ext.column.Column and Ext.table.View and none of that worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文