How to get filtered Data result set from jQuery Datatable

 ̄綄美尐妖づ 提交于 2019-11-30 04:55:36

see dataTables selector-modifiers. You are looking for {filter : 'applied'} :

table.on('search.dt', function() {
    //number of filtered rows
    console.log(table.rows( { filter : 'applied'} ).nodes().length);
    //filtered rows data as arrays
    console.log(table.rows( { filter : 'applied'} ).data());                                  
})  

demo -> http://jsfiddle.net/h4wrmfx3/

if you are using server side filtering / searching, this is the only solution i found and it works: xhr event

$('#yourTable').on('xhr.dt', function ( e, settings, json, xhr ) {
        //the new data is here json.data
        console.log(json.data);
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!