我正在尝试使用 Pentaho 6.1 CE CTools 创建自定义报告页面。
从Pentaho UI中,我创建了一个带有3个SQL查询的CDA: 1. query_all_rows (查询表的所有行); 2. query1 (具有第一列所有唯一行的查询); 3. query2 (具有第四列所有唯一行的查询)。
我创建了一个表组件 table_new 和一个“导出按钮”组件 exportButton 。
我将使用第一个查询 query_all_rows 的结果创建一个表。 我还将创建两个文本字段(第一列在第一列上,第二列在第四列上)以过滤该列中的数据,但是当用户在该字段中写一些文本时,它会显示 query1的结果,对于第一个字段,该文本以下拉列表之类的文本开头,而对于第二个字段,则以 query2 的结果开头。 最后,我将创建一个按钮以导出过滤的行。
我正在尝试在 tableComponent table_new 的 postExecution 中使用以下代码:
function f() {
$(document).ready(function () {
// Setup - add a text input to each footer cell
var arrayColumns = ['ID', 'Type'];
$('#example thead th').each(function () {
var testo = $('#example thead th').eq($(this).index()).html();
var title = $('#example thead th').eq($(this).index()).text();
if (arrayColumns.indexOf(title) > -1) {
$(this).html(testo + '<br><input type="text" placeholder="Search ' + title + '">');
}
});
// DataTable
var table = $('#example').DataTable();
// Apply the search.
table.columns().eq(0).each(function (colIdx) {
$('input', table.column(colIdx).header()).on('keyup change clear', function () {
table
.column(colIdx)
.search(this.value)
.draw();
});
// If you click in the field, it doesn't sort the results in the column in ascending/descending order.
$('input', table.column(colIdx).header()).on('click', function (e) {
e.stopPropagation();
});
});
});
}
问题