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

posted @ 2015-07-03 10:10  pengisgood  阅读(1140)  评论(0编辑  收藏  举报