Pentaho 6.1-如何使用输入文本过滤表组件的行并导出过滤的行

时间:2019-10-02 11:00:09

标签: javascript jquery pentaho pentaho-cde pentaho-ctools

我正在尝试使用 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();
            });
        });
    });
}
  • 问题

    1. 如果我在文本字段中搜索,则无法正确过滤列中的值。
    2. 当用户在字段中写一些文本时,我不知道如何显示query1 / query2的结果。
    3. 如果我单击“导出”按钮,它将创建一个包含第一个结果页面结果的文件,但是我想要一个仅包含过滤结果行的文件。

0 个答案:

没有答案