Row duplication bug with sAjaxSource, bServerSide and bScrollInfinite when you show/hide columns
Row duplication bug with sAjaxSource, bServerSide and bScrollInfinite when you show/hide columns
paul4
Posts: 1Questions: 0Answers: 0
Hi All,
I think I found a bug when you use sAjaxSource, bServerSide and bScrollInfinite then try to show / hide columns.
When you hide columns, the number of rows duplicates each time. It auto fixes itself when you perform a search since the data reloads from the server, however, since it is simply a show / hide column action, there should be no reason to reload the data.
An example can be found here (based of some of the examples from 1.8.1):
http://www.faure.ca/fhl-dev/tpl/DataTables-1.8.1/examples/basic_init/scroll_y_infinite.html#
I setup the datatables like this:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": 'single_json_source.txt',
"bScrollInfinite": true,
} );
} );
[/code]
And then toggle the column visibility like this:
[code]
function fnToggleColumn( iCol ){
/* Get the DataTables object again - this is not a recreation, just a get of the object */
var oTable = $('#example').dataTable();
var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
oTable.fnSetColumnVis( iCol, bVis ? false : true );
}
[/code]
Thanks for the great code and support,
Paul
I think I found a bug when you use sAjaxSource, bServerSide and bScrollInfinite then try to show / hide columns.
When you hide columns, the number of rows duplicates each time. It auto fixes itself when you perform a search since the data reloads from the server, however, since it is simply a show / hide column action, there should be no reason to reload the data.
An example can be found here (based of some of the examples from 1.8.1):
http://www.faure.ca/fhl-dev/tpl/DataTables-1.8.1/examples/basic_init/scroll_y_infinite.html#
I setup the datatables like this:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": 'single_json_source.txt',
"bScrollInfinite": true,
} );
} );
[/code]
And then toggle the column visibility like this:
[code]
function fnToggleColumn( iCol ){
/* Get the DataTables object again - this is not a recreation, just a get of the object */
var oTable = $('#example').dataTable();
var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
oTable.fnSetColumnVis( iCol, bVis ? false : true );
}
[/code]
Thanks for the great code and support,
Paul
This discussion has been closed.
Replies
Allan