invoke the Info callback
invoke the Info callback
mdusoe
Posts: 2Questions: 0Answers: 0
I have a table with rows that contain a checkbox for selection. I have code to get the number of selected rows like this:
[code]
function countSelected(){
if(tbl){
return jQuery('input[name=selected_proposal]:checked', tbl.fnGetNodes()).length;
}
return 0;
}
[/code]
I then init the table like this, using that function to return a modified info string:
[code]
return jQuery('.dataGrid').dataTable({
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
var count = countSelected();
var str = "";
if(count > 0){
str = ", " + count + " of which are selected."
}
return sPre + str;
},
"bAutoWidth": false,
"bJQueryUI": true,
"bPaginate": true,
"bSort": true,
"bInfo": true,
"sScrollX": "100%",
"sScrollXInner": "150%",
"bFilter": true
})
[/code]
My question is, how do I get the Info to redraw on the check of a box? When the user checks a box, the info string is not updated until they change pages or change filters or something else that causes a Draw. Unfortunately, calling tbl.fnDraw() in the click handler doesn't work, because it always sends them back to page 1.
Thanks in advance for any help you can provide.
Mike.
[code]
function countSelected(){
if(tbl){
return jQuery('input[name=selected_proposal]:checked', tbl.fnGetNodes()).length;
}
return 0;
}
[/code]
I then init the table like this, using that function to return a modified info string:
[code]
return jQuery('.dataGrid').dataTable({
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
var count = countSelected();
var str = "";
if(count > 0){
str = ", " + count + " of which are selected."
}
return sPre + str;
},
"bAutoWidth": false,
"bJQueryUI": true,
"bPaginate": true,
"bSort": true,
"bInfo": true,
"sScrollX": "100%",
"sScrollXInner": "150%",
"bFilter": true
})
[/code]
My question is, how do I get the Info to redraw on the check of a box? When the user checks a box, the info string is not updated until they change pages or change filters or something else that causes a Draw. Unfortunately, calling tbl.fnDraw() in the click handler doesn't work, because it always sends them back to page 1.
Thanks in advance for any help you can provide.
Mike.
This discussion has been closed.
Replies
Allan
Edit - But thank you for the response :)
Allan