incorrect result using fnGetNodes() after a value is searched in searchbox of jquerydataTables1.9.4
incorrect result using fnGetNodes() after a value is searched in searchbox of jquerydataTables1.9.4
Pallavi
Posts: 8Questions: 0Answers: 0
I am using jquery.dataTables.js(1.9.4).
I am using checkbox for select all and deselect all,but I wanted checked value of checkbox of all pages to be persisted so I used
[code]
$(xytable.fnGetNodes()).find("input[name='chklist']").length //to get length of checkboxes
and
$(xytable.fnGetNodes()).find("input[name='chklist']:checked").length // to find length of checked checkboxes
[/code]
here xytable -->table id
but when I search a value in search box then the content changes say from 8 results their are only 2 result displayed(which is correct) but the length I get of all the checkboxes by fnGetNodes() remain 8 and not 2(which is incorrect) !!!!
I am using checkbox for select all and deselect all,but I wanted checked value of checkbox of all pages to be persisted so I used
[code]
$(xytable.fnGetNodes()).find("input[name='chklist']").length //to get length of checkboxes
and
$(xytable.fnGetNodes()).find("input[name='chklist']:checked").length // to find length of checked checkboxes
[/code]
here xytable -->table id
but when I search a value in search box then the content changes say from 8 results their are only 2 result displayed(which is correct) but the length I get of all the checkboxes by fnGetNodes() remain 8 and not 2(which is incorrect) !!!!
This discussion has been closed.
Replies
Allan
http://jsfiddle.net/Pallavik/pJG9f/45/
here length remains 6,even if 1 result(checkbox) is displayed when 'g' is searched in Search Box and 'Click here to check length' is clicked.
I have used definitions for dataTable as
[code]
oTable=$("#tablename").dataTable({
"bProcessing":true ,
"sProcessing":"Processing",
"iDisplayLength": 5,
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 0,4 ]}
] ,
"bPaginate": true,
"sPaginationType": "input",
"bInfo": false,
"bAutoWidth": false,
});
[/code]
is anything in definition causing trouble?
I have used definitions for dataTable as
[code]
oTable=$("#tablename").dataTable({
"bProcessing":true ,
"sProcessing":"Processing",
"iDisplayLength": 5,
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 0,4 ]}
] ,
"bPaginate": true,
"sPaginationType": "input",
"bInfo": false,
"bAutoWidth": false,
});
[/code]
is anything in definition causing trouble?
Allan
I don't want only currently visible ones as I have used pagination .
In short I want total length of the checkboxes (including in 2nd,3rd etc pages)after search is applied and total length of checkboxes which are checked(after search is applied).
Allan
used
[code]
oTable._("input[name='chklist']", {"filter":"applied"}); //to find all my checkboxes
//and
oTable._("input[name='chklist']:checked", {"filter":"applied"}); //to find all my checked checkboxes
[/code]