动态设置gridview列背景

时间:2017-07-26 08:14:16

标签: javascript extjs background-color sencha-architect

我使用的是Ext JS 4.0和Sencha Architect 4.1

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

我知道如何使用渲染器更改单元格背景。但是我不知道如何为整个专栏做这个,因为我不想为我的gridview中的每个单元格设置渲染器。

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

2 个答案:

答案 0 :(得分:3)

我这样解决了:

在Site.css中我添加了一个这样的样式

add_filter( 'gform_notification_19', 'change_notification_email', 10, 3 );
function change_notification_email( $user_email, $notification, $form, $entry ) {


    //There is no concept of admin notifications anymore, so we will need to target notifications based on other criteria, such as name
    if ( $notification['name'] == 'Applicant' ) {

        global $post;
        $author_id=$post->post_author;
        $user_email = get_the_author_meta( 'user_email' , $author_id );

        // toType can be routing or email
        $notification['toType'] = 'email'; 
        $notification['to'] = $user_email;

    }

    return $notification;
}

在我的.custom-row .x-grid-cell { background-color: #ffe2e2; } 我添加了Ext.grid.View这样的方法

getRowClass

答案 1 :(得分:1)

使用列上的{{1}}配置,然后编写css规则以适当地应用样式。

http://docs.sencha.com/extjs/4.2.6/#!/api/Ext.grid.column.Column-cfg-tdCls