jquery DataTables. How to get filtered (visible) rows

后端 未结 7 1444
盖世英雄少女心
盖世英雄少女心 2021-02-07 02:28

I have a button that apply filter to jquery datatable

$(\"#buttonFilter\").button().click(function() {
                if (lboxColor.val() != null) {
                    


        
7条回答
  •  春和景丽
    2021-02-07 02:58

    For those who are interested, this is a concrete usecase.

    /**
     * Select all the elements of the datatable which match the current user
     * search (or all if no search).
     */
    function dtable_selectAll()
    {
        idTable = 'myDataTable';
        var rows = $('#' + idTable).dataTable()
                .$('tr', {"filter":"applied"});
        var oTT = TableTools.fnGetInstance(idTable);
        $(rows).each(function (index, el){
            oTT.fnSelect(el);
        })
    }
    

    Hope it helps.

提交回复
热议问题