gpt4 book ai didi

javascript - EXTJS 5 树网格自定义行 css

转载 作者:行者123 更新时间:2023-11-30 16:57:14 25 4
gpt4 key购买 nike

我有一个树形网格,我想更改父行和子行的 css(在我的例子中是背景颜色)。我做了一些 css 类并使用了 viewConfig.getRowClass 方法,但它不适用于悬停和选择。

这是我的问题的 fiddle :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 不起作用吗?

提前致谢 =) !

最佳答案

.row-parent .x-grid-cell {
background-color: #c1ddf1 !important;
}
.x-grid-item-over .row-parent .x-grid-cell {
background-color: #3da5f5 !important;
}
.x-grid-item-selected .row-parent .x-grid-cell {
background-color: #ff0 !important;
}

.row-child .x-grid-cell {
background-color: #e2eff8 !important;
}
.x-grid-item-over .row-child .x-grid-cell {
background-color: #85c4f5 !important;
}
.x-grid-item-selected .row-child .x-grid-cell {
background-color: #ff0 !important;
}

关于javascript - EXTJS 5 树网格自定义行 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29488091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com