scroller with filter

scroller with filter

jkjkjjkjkj Posts: 8Questions: 4Answers: 0

hello,all
i use datatable with some options
deferRender: true,
paging: true,
scroller: true,
scrollX: true,
responsive:false,

also i use $.fn.dataTable.ext.search.push() to add my own search filter

after apply my own search filter,it did work,and the satified data also has many,so the scroller should work too

when i move the scroller, the search filter is not work,some rows not satify search filter still shown

so i wanna know whether there are some method to solve this problem?thakn you all

the code is as follow

var table = $("#Table").DataTable({
dom: '<"row"<"col-6"f><"col-6"i>>t',
keys: true,
scrollY: "73vh",
autoWidth: false,
rowId: 'Id',
deferRender: true,
paging: true,
scroller: true,
scrollX: true,
responsive:false,
search: {
return: false
},
select: {
style: 'single',
blurable: false,
toggleable: false,
info: false,
},
columns:[{}]
});

$.fn.dataTable.ext.search.push(function (settings, data, dataIndex) {

if (data[2] == "S") {
    return false
}
return true;

});

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,370Questions: 26Answers: 4,779
    Answer ✓

    See Allan's response in your other thread. Without seeing the problem its impossible to say what the issue might be. for example we have no idea if if (data[2] == "S") { will ever be true without seeing your data. You can do some debugging of this code to see what is happening. Or we can but we will need a link to your page or a test case showing the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • kthorngrenkthorngren Posts: 20,370Questions: 26Answers: 4,779

    If you want the search plugin to be active when Datatables initializes then move it before the Datatables init code. Otherwise you will need to force a table draw event to happen to execute the plugin. Performing any table action like sort, search or page will redraw the table or you can call the draw() API.

    Kevin

Sign In or Register to comment.