ExtJS 4(Sencha)中的网格不允许默认选择内容。但我想让这成为可能。使ExtJS 4网格内容可选
我已经试过此网格配置:
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>'
)
}
任何su ggestions非常感谢。
真棒,谢谢选择。 虽然我怀疑,这是一个迹象,我试图使用网格的东西,它不是为了 - 我使用纯粹的网格显示目的,并没有使用它的任何编辑功能。 我最终只是使用了一个带有XTemplate的面板,该面板渲染出了一张平面简洁的表格。 – keeny
@keeny我知道这是非常古老的,但我经常使用网格显示功能。他们非常适合排序和风格 – WattsInABox