1
我有一個樹形網格,我想改變父行和子行的CSS(在我的情況下背景顏色)。 我做了一些CSS類,並使用viewConfig.getRowClass方法,但它不適用於懸停和選擇。EXTJS 5樹網格自定義行css
這裏是我的問題的小提琴:https://fiddle.sencha.com/#fiddle/jl1
這是我的樹格:
var tree = Ext.create('Ext.tree.Panel', {
renderTo: Ext.getBody(),
title: 'TreeGrid',
rootVisible: false,
width: 300,
height: 250,
store: store,
viewConfig: {
getRowClass: function(record, index) {
if (record.get('name').indexOf('Group') != -1) {
return 'row-parent';
}
return 'row-child';
}
},
columns: [{
xtype: 'treecolumn',
text: 'Name',
dataIndex: 'name',
width: 150
}, {
text: 'Description',
dataIndex: 'description',
width: 150
}]
});
這是我的CSS:
.row-parent .x-grid-cell {
background-color: #c1ddf1 !important;
}
.row-parent .x-grid-row-over .x-grid-cell {
background-color: #3da5f5 !important;
}
.row-parent .x-grid-row-selected .x-grid-cell {
background-color: #ff0 !important;
}
.row-child .x-grid-cell {
background-color: #e2eff8 !important;
}
.row-child .x-grid-row-over .x-grid-cell {
background-color: #85c4f5 !important;
}
.row-child .x-grid-row-selected .x-grid-cell {
background-color: #ff0 !important;
}
你知道爲什麼選擇和懸停CSS不起作用?
在此先感謝=)!