zoukankan      html  css  js  c++  java
  • ExtJS 使用点滴 二 如何使用XTemplate基于同行的其他列的值,改变当前列的显示样式

    //Treegrid formatting function 
    function fn(v, values){ 
        i = i + 1
        switch(i){ 
            case 1: x = values.alarm1; break
            case 2: x = values.alarm2; break
            default: alert("x not assigned value"); 
        } 
        if (x == 1) {return '<span style="background-color: red;  100%">' + v + '</span>';} 
        else if(i == currenthour) 
            {return '<span style="background-color:' + currentcolor + ';  100%">' + v + '</span>';} 
        else 
            {return '<span style="background-color:' + basecolor + ';  100%">' + v + '</span>';}   

     
    //create the treegrid 
    columns:[ 
     

            {header: 'Name',dataIndex: 'name'210}, 
            {header: 'H1',  60, dataIndex: 'duration1', align: 'center',               
                tpl: new Ext.XTemplate('{duration1:this.doFormat}', {doFormat: fn})}, 
                {header: 'A1',  0,dataIndex: 'alarm1' , visibility: false}, 
            {header: 'H2',  60, dataIndex: 'duration2',align: 'center'
                tpl: new Ext.XTemplate('{duration2:this.doFormat}', {doFormat: fn})}, 
                {header: 'A2',  0,dataIndex: 'alarm2' , visibility: false}, 
  • 相关阅读:
    Objective C
    MySQL 存储过程,游标,临时表创建
    List connected users–similar to task manager
    游戏视频编辑
    游戏音频编辑
    UE4 AI BehaviorTree 动画播放完成通知机制
    UE4 AI BehaviorTree 各个节点执行顺序总结
    Holographic Remoting
    Hololens 手势事件执行顺序
    Hololens 硬件细节 Hardware Detail
  • 原文地址:https://www.cnblogs.com/FredTang/p/2625337.html
Copyright © 2011-2022 走看看