Search value Restriction to the Columns Visible in datatable.

Search value Restriction to the Columns Visible in datatable.

sairampamidi1989sairampamidi1989 Posts: 2Questions: 2Answers: 0

Hello All,

I am new to datatable ,i am try to Restrict search to only visible columns in datatable,but search happens entire grid ,even the column is "not -visible"

ex:-

https://datatables.net/examples/api/show_hide.html

take following Example,here I clicked on Name toggle button ,after that i am able to see the reaming columns,but when try to search following text " Airi Satou " it showing that Record of " Airi Satou " ,I don't want that ,I want when i search "Airi Satou" if Name is visible then only i want to that record other wise ,No Record found.

I am tried Following ways.

$('.js-txtSearch').keyup(function (e) {
if ($(this).val().length >= 1 || $(this).val() == 0) {
var table = $('#tblRegionMaintenance').DataTable();
table.column([0,1,2,3]).search($(this).val()).draw();
}
});

".js-txtSearch" is class name of external Searxh Text box.

"tblRegionMaintenance" is Id of my Data-table,when try to search above way it is not working .

This discussion has been closed.