Search checkbox ext

Search checkbox ext

sairus95sairus95 Posts: 5Questions: 2Answers: 0
edited April 2021 in DataTables

Hello

I would like to make 4 checkboxes which sort for me the presence of data in 4 different columns the data is of number. display lines whose value is greater than 0
I started by doing that

<input type = "checkbox" name = "ady1">
<input type = "checkbox" name = "ady2">
<input type = "checkbox" name = "sllf">
<input type = "checkbox" name = "jlm">

initComplete: function () {
$ .fn.dataTable.ext.search.push (
function (settings, searchData, index, rowData, counter) {
var checkedAdy1 = $ ('input: checkbox [name = "ady1"]'). is (': checked');
var checkedAdy2 = $ ('input: checkbox [name = "ady2"]'). is (': checked');
var checkedSllf = $ ('input: checkbox [name = "sllf"]'). is (': checked');
var checkedJlm = $ ('input: checkbox [name = "jlm"]'). is (': checked');

if (checkedAdy1 && searchData [29]>= 1) {
return false;
}
return true;
if (checkedAdy2 && searchData [30]>= 1) {
return false;
}
return true;
if (checkedSllf && searchData [31]>=1) {
return false;
}
return true;
if (checkedJlm && searchData [32]>= 1) {
return false;
}
return true;
});
},

  $ ('input: checkbox'). on ('change', function () {
    table
.search ('')
.columns ()
.draw ();
  });

this function that on my column 29 the others not work can you help me thank you.``

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.