Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 动态设置gridview列背景_Javascript_Extjs_Background Color_Sencha Architect - Fatal编程技术网

Javascript 动态设置gridview列背景

Javascript 动态设置gridview列背景,javascript,extjs,background-color,sencha-architect,Javascript,Extjs,Background Color,Sencha Architect,我正在使用ExtJS4.0和Sencha Architect 4.1 我想根据相应记录的值设置每列的列背景 我知道如何使用渲染器更改单元格背景。但我不知道如何对整个列执行此操作,因为我不想为gridview中的每个单元格设置渲染器 有没有办法为整个列设置背景?使用列上的tdCls配置,然后编写css规则以应用适当的样式 使用列上的tdCls配置,然后编写css规则以应用适当的样式 我是这样解决的: 在Site.css中,我添加了如下样式 .custom-row .x-grid-cell {

我正在使用ExtJS4.0和Sencha Architect 4.1

我想根据相应记录的值设置每列的列背景

我知道如何使用渲染器更改单元格背景。但我不知道如何对整个列执行此操作,因为我不想为gridview中的每个单元格设置渲染器


有没有办法为整个列设置背景?

使用列上的
tdCls
配置,然后编写css规则以应用适当的样式


使用列上的
tdCls
配置,然后编写css规则以应用适当的样式

我是这样解决的:

在Site.css中,我添加了如下样式

.custom-row .x-grid-cell {
    background-color: #ffe2e2;
}
viewConfig: {
    getRowClass: function(record, rowIndex, rowParams, store) {
        var isConditionMatching = ....

        if(isConditionMatching ){
            return 'custom-row';
        }
    },
在我的
Ext.grid.View
中,我添加了
getRowClass
方法,如下所示

.custom-row .x-grid-cell {
    background-color: #ffe2e2;
}
viewConfig: {
    getRowClass: function(record, rowIndex, rowParams, store) {
        var isConditionMatching = ....

        if(isConditionMatching ){
            return 'custom-row';
        }
    },
我是这样解决的:

在Site.css中,我添加了如下样式

.custom-row .x-grid-cell {
    background-color: #ffe2e2;
}
viewConfig: {
    getRowClass: function(record, rowIndex, rowParams, store) {
        var isConditionMatching = ....

        if(isConditionMatching ){
            return 'custom-row';
        }
    },
在我的
Ext.grid.View
中,我添加了
getRowClass
方法,如下所示

.custom-row .x-grid-cell {
    background-color: #ffe2e2;
}
viewConfig: {
    getRowClass: function(record, rowIndex, rowParams, store) {
        var isConditionMatching = ....

        if(isConditionMatching ){
            return 'custom-row';
        }
    },

你能再详细一点吗?我对ExtJS和Javascript非常陌生,不知道如何实现这一点。就像我说的。分配一个
tdCls
,写一些css:谢谢你的示例。问题是:我想根据分配给行的记录的属性设置背景。据我所知,我不能把这个逻辑放在css文件中。然后写一个渲染器。这就是为什么我问这个问题。目前我为每个单元都有一个渲染器,我想可能有更好的解决方案。你能更详细一点吗?我对ExtJS和Javascript非常陌生,不知道如何实现这一点。就像我说的。分配一个
tdCls
,写一些css:谢谢你的示例。问题是:我想根据分配给行的记录的属性设置背景。据我所知,我不能把这个逻辑放在css文件中。然后写一个渲染器。这就是为什么我问这个问题。目前,每个单元格都有一个渲染器,我想可能有更好的解决方案。您的问题特别询问了设置特定列的样式。。。“有没有办法为整个栏目设置背景?”您的问题特别询问了如何为特定栏目设置样式。。。“有没有办法为整个栏目设置背景?”