2017-08-03 67 views
0

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

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>"; } }; 
 
      } 
 
     }); 
 
}

回答

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>"; } }; 
      } 
     }) ; 
}  

你也必须更新高级属性列类型 - 做定期专栏类型“串”或不管他们是和变革格式化的列改为“formattedText”。