2017-08-03 68 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」。