【问题标题】:ExtJS 4.2 treepanel highlight row on cell selectionExtJS 4.2树形面板突出显示单元格选择行
【发布时间】:2019-09-11 11:04:04
【问题描述】:

我有一个带有单元格选择的树形面板:

selModel: Ext.create('Ext.selection.CellModel', {
    listeners: {
        select: function (cellModel, record, rowIndex) {
            var myGrid = Ext.ComponentQuery.query('view #grid')[0];
            myGrid.getView().addRowCls(rowIndex, 'style');
        },
        deselect: function (cellModel, record, rowIndex) {
            var myGrid = Ext.ComponentQuery.query('view #grid')[0];
            myGrid.getView().removeRowCls(rowIndex, 'style');
        },
        scope: this
    }
}),

并且列有tdCls 属性:

tdCls : 'greyColumn/yellowColumn', //It depends on the position

- grayColumn/yellowColumn STYLE -

.x-grid-row .greyColumn{
    background-color:#f2f2f2;
}
.x-grid-row .yellowColumn {
    background-color:#ffffcc;
}

- selModel STYLE -

.x-grid-row .style{
    background-color: red !important;
}

tdCls 属性完美运行,单元格颜色正确。 但是当我选择一个单元格时,该行没有变成红色。

知道我做错了什么吗??

【问题讨论】:

    标签: extjs extjs4.2


    【解决方案1】:

    你改变了元素 tr 的背景颜色,它是低一级的。 看看我的fiddle 即使要更改行的背景色,也​​必须更改单元格的背景色。

    【讨论】:

    • 并且不要使用dom查询来给treeView。它存在于属性 view 的 cellModel 中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多