Select All Checkbox is updating even rows which are not filtered
Select All Checkbox is updating even rows which are not filtered
Sandeepbrungi7
Posts: 11Questions: 3Answers: 0
$('#selectAllMembers').on('click', function(){
var rows = table.rows({search: 'applied'}).nodes();
$('input[type="checkbox"]', rows).prop('checked', this.checked);
});
Using search functionality i'm filtering rows and selecting all filtered rows and applying some change. Change is applying to filtered rows + few rows which are not filtered
Answers
I copied your code snippet into this test case:
https://live.datatables.net/mehozinu/1/edit
The code seems to work when searching the table, clicking Select All then clearing the search. Only those rows displayed when searching are checked.
Please update the test case or tell us how to replicate the issue so we can help debug.
Kevin
For example:
as per attached image..i am updating filtered record by selecting all checkbox option.Then it is updating correctly.
When i remove search filter..all rows are getting this change
when i clear 140 from the search box...all rows in the tables are effected with change made to this filter row
var pageInfo = table.page.info();
var pageNum = pageInfo.page;
var rows= table.rows({ filter: 'applied' }).nodes();
var newdata=[];
var isPendselected=false;
var isAbstractionStateMatched=false;
_.each(rows.data(),function(rowData,index){
if($(":checkbox:checked", $(rows[index])).prop('checked') ){}
this is the code executing after select all checkbox
There is nothing obvious in your code snippet. Please update my example or provide a test case showing the issue so we can help debug.
Kevin
https://live.datatables.net/mehozinu/4/edit
after selecting filtered rows using select all checkbox..next a pop modal will open & display "Ok or Cancel button" the code provided in the link is after clicking on OK
The test case doesn't run. Its getting a syntax error:
I still don't see anything obvious to cause the problem. Please update the test case so it runs and replicates the issue.
Kevin