【发布时间】:2023-03-14 08:38:01
【问题描述】:
默认情况下,ExtJS 4 (Sencha) 中的网格不允许选择内容。但我想让这成为可能。
我试过这个网格配置:
viewConfig: {
disableSelection: true,
stripeRows: false,
getRowClass: function(record, rowIndex, rowParams, store){
return "x-selectable";
}
},
使用这些 css 类(基本上针对我在 Chrome 中可以看到的每个元素):
/* allow grid text selection in Firefox and WebKit based browsers */
.x-selectable,
.x-selectable * {
-moz-user-select: text !important;
-khtml-user-select: text !important;
-webkit-user-select: text !important;
}
.x-grid-row td,
.x-grid-summary-row td,
.x-grid-cell-text,
.x-grid-hd-text,
.x-grid-hd,
.x-grid-row,
.x-grid-row,
.x-grid-cell,
.x-unselectable
{
-moz-user-select: text !important;
-khtml-user-select: text !important;
-webkit-user-select: text !important;
}
我知道您可以在 Ext 3 中覆盖网格行模板,如下所示,但我不知道如何在 Ext 4 中执行相同操作:
templates: {
cell: new Ext.Template(
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>',
'<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>',
'</td>'
)
}
非常感谢任何建议。
【问题讨论】:
标签: javascript extjs4 extjs