Update all tables when 1 bLengthChange value is changed
Update all tables when 1 bLengthChange value is changed
drewhjava
Posts: 9Questions: 0Answers: 0
Hey guys. This is my datatable code
[code]
$('.reportTable').each(function() {
var pkgLineId = $(this).attr('title');
var reportTable = $(this).dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bPaginate": true,
"bLengthChange": true,
"bFilter": false,
"bSort": false,a
"bInfo": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sDom": '<"H"lfrp>t<"F"lip>',
"iDisplayLength": 15,
"aLengthMenu": [[10, 15, 20, 50, 100, 200, 500], [10, 15, 20, 50, 100, 200, 500]],
"aoColumns": [
{
"bVisible": false
},
null,
null,
null,
null,
null,
null
],
"sAjaxSource": '/json/reportData/'+pkgLineId,
"fnDrawCallback": function() {
var nodes = reportTable.fnGetNodes();
var lineStatus;
for (var i = 0; i < nodes.length; i++) {
lineStatus = reportTable.fnGetData(nodes[i]);
nodes[i].setAttribute("style", "background: " + lineStatus[0]);
}
}
});
});
[/code]
I have several tables on one page. If someone changes length of one I want to change the length of all of the tables on the page. I guess I'm looking for a callback for that change and then a datatable redraw. I think what makes it tricky is the server side processing. Thanks for the help.
[code]
$('.reportTable').each(function() {
var pkgLineId = $(this).attr('title');
var reportTable = $(this).dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bPaginate": true,
"bLengthChange": true,
"bFilter": false,
"bSort": false,a
"bInfo": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sDom": '<"H"lfrp>t<"F"lip>',
"iDisplayLength": 15,
"aLengthMenu": [[10, 15, 20, 50, 100, 200, 500], [10, 15, 20, 50, 100, 200, 500]],
"aoColumns": [
{
"bVisible": false
},
null,
null,
null,
null,
null,
null
],
"sAjaxSource": '/json/reportData/'+pkgLineId,
"fnDrawCallback": function() {
var nodes = reportTable.fnGetNodes();
var lineStatus;
for (var i = 0; i < nodes.length; i++) {
lineStatus = reportTable.fnGetData(nodes[i]);
nodes[i].setAttribute("style", "background: " + lineStatus[0]);
}
}
});
});
[/code]
I have several tables on one page. If someone changes length of one I want to change the length of all of the tables on the page. I guess I'm looking for a callback for that change and then a datatable redraw. I think what makes it tricky is the server side processing. Thanks for the help.
This discussion has been closed.
Replies
Allan
Allan