天天看點

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

我使用的版本

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

作者:make dream

出處:http://www.cnblogs.com/penghongwei/

本文版權歸作者,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接配接,否則保留追究法律責任的權利。