Pentaho BI server 中 CCC table Component 的使用小技巧

pengisgood發表於2015-07-03

我使用的版本

Pentaho BI Server 5.3.0.0.213
CDE/CDF/CDA/CCC 15.04.16 stable
 

Q: 如何設定表格中各種提示文字的語言(預設為英語)?

CDE -> table Component -> Advanced Properties -> oLanguage,編輯該屬性,語法需滿足 JavaScript Objective 的語法,可以設定的引數如下:
{
     "sProcessing": "Processing...",
     "sLengthMenu": "Show _MENU_ entries",
     "sZeroRecords": "No matching records found",
     "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
     "sInfoEmpty": "No data found",
     "sInfoFiltered": "(filtered from _MAX_ entries)",
     "sInfoPostFix": "",
     "sSearch": "Search:",
     "sUrl": "",
     "oPaginate": {
          "sFirst": "",
          "sPrevious": "Previous",
          "sNext": "Next",
          "sLast": ""
     }
}

其中粗體的部分為佔位符,在翻譯成其他語言的時候請保持不變。

 

Q: 如何設定table 中某一列以百分比顯示?

1. CDE -> table Component -> Properties -> Column Types,設定對應列的 value 為:formattedText。
2. CDE -> table Component -> Advanced Properties -> Pre Execution,新增如下程式碼:
 
function() {  
    this.setAddInOptions("colType","formattedText",function(cell_data){
        return {textFormat: function(v, st) {return (v*100).toFixed(2) + '%'}};
      });
} 

 

Q: 如何往 page length 下拉框中新增選項?

1. CDE -> table Component -> Advanced Properties -> Post Execution,新增如下程式碼:
 
function() {
    $('select[name="<HtmlObject的值>Table_length"]').append($('<option>',
        {
            value: '<需要新增的選項的value>',
            text: '<需要新增的選項的label>'
        }
    ));    
} 

 

references:

http://forums.pentaho.com/showthread.php?91709-Using-oLanguage-in-CDE-Table-Component

http://pentaho-bi-suite.blogspot.com/2014/06/conditional-coloring-of-cell-values-in.html

相關文章