Pentaho 6.1-在字段中搜索时如何显示可能结果的下拉列表?

时间:2019-10-02 13:51:32

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

我在两个字段中查找表的第一和第四列中显示的值。我想显示一个以我正在写的文本开头的可能值的下拉列表。

如何在表组件的后执行中更改以下javascript函数来做到这一点?

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();
            });
        });
    });
}

0 个答案:

没有答案