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

paul4paul4 Posts: 1Questions: 0Answers: 0
edited August 2011 in Bug reports
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

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Interesting one - I've taken a note to have a look into though. Certainly fnSetColumnVis shouldn't be doing a full redraw as you say since there isn't really any need, but it is almost certainly going to be complicated by the infinite scrolling and how that deals with rows which are "active".

    Allan
This discussion has been closed.