Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Hide rows from datatables

$
0
0

I have the following Datatable :

I can change the status of a row by the toggle switch custom,

Now I'm trying to hide the rows with status = 0

So I tried the following code

var table = $('#example').DataTable();

$("#hide").click(function() {
    $.fn.dataTable.ext.search.push(
      function(settings, data, dataIndex) {
          return $(table.row(dataIndex).node()).attr('data-user') == 1;
        }
    );
    table.draw();
});    
$("#reset").click(function() {
    $.fn.dataTable.ext.search.pop();
    table.draw();
});


But doesn't work with me.


Viewing all articles
Browse latest Browse all 2364

Trending Articles