ctools表组件条件格式

时间:2017-08-03 19:19:44

标签: pentaho conditional-formatting

我不知道这是否是提出这个问题的正确论坛,但我想我会试一试 - 有没有人使用Pentaho Ctools?我正在尝试将条件格式应用于我的表组件的第8列,但到目前为止还没有。任何想法都将不胜感激!

function f(){  
    this.setAddInOptions("numeric","formattedText",function(statusReport){
        var days = statusReport.value;
        if(statusREport.colIndex == 8)
        if(days <=30){
            return {  textFormat: function(v, st) { return "<span style='color:green'>"+v+"</span>"; } };
        }
         else {
            return { textFormat: function(v, st) { return "<span style='color:red'>"+v+"</span>"; }  };
            }
      });
} 

1 个答案:

答案 0 :(得分:0)

执行前功能:

function f(){  
//conditional coloring of cells 
    this.setAddInOptions("colType","formattedText",function(cell_data){
        var days = cell_data.value;
        if(cell_data.colIdx == 7)
        {
            if(!cell_data.value) //checking the null possibility
            {
                this.value = '00000';
            }
        }
        if(days > 30){
            return {  textFormat: function(v, st) { return "<span style='color:#FF0000'>"+v+"</span>"; } };
        }
         else if(days <= 30) {
            return { textFormat: function(v, st) { return "<span style='color:#000000'>"+v+"</span>"; }  };
            }
      })   ;  
}     

您还必须更新高级属性中的列类型 - 制作常规列类型&#34; string&#34;或者它们是什么,并将格式化的列更改为&#34; formattedText&#34;。