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