Using bScrollInfinite: true causes the sEmptyTable message to display incorrectly

Using bScrollInfinite: true causes the sEmptyTable message to display incorrectly

greengrassgreengrass Posts: 3Questions: 0Answers: 0
edited April 2012 in Bug reports
When initializing a table with

[code]bScrollInfinite: true[/code]

then using fnAddData to add several records, then the sEmptyTable message will not disappear after data is added, but will instead display multiple times on top of the data that is added to the table.

Example table construction:
[code]
$("#sample").dataTable({
bJQueryUI: true
, aaSorting: [[0, 'desc']]
, bFilter: false
, bAutoWidth: true
, bScrollInfinite: true
, iDisplayLength: spsUtilities.INFINITE_SCROLL_CHUNK
, sScrollY: "250"
, bScrollCollapse: true
, sScrollX: "100%"
, sScrollXInner: "160%"
, aoColumns: [ { } //add
,{ } //required date
,{sWidth: '23em', sClass: 'materialColumn' } //material
,{sWidth: '6em', sClass: 'rightTxt editQuantity'} //qty/ea
,{sWidth: '4em', sClass: 'rightTxt' } //Bnd
,{sWidth: '6em', sClass: 'rightTxt' } //Weight
,{sWidth: '7em', sClass: 'rightTxt' } //$/CWT
,{sWidth: '7em', sClass: 'rightTxt' } //Net Value
,{ } //Status
,{sWidth: '3em', sClass: 'deleteColumn', bSortable:false } //reject
,{} //Shipping conditions
,{ } //document/line
,{ } //mill (valuation type)
]
, oLanguage: {
"sEmptyTable": "No records",
"sInfo": "Open quotes: _TOTAL_ records",
"sInfoEmpty": ""
}
});
[/code]

I also do not use fnDraw to redraw the table, but instead I use

[code]fnAdjustColumnSizing()[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    I've just put together this simple example which is acting as I would expect it to: http://live.datatables.net/iruvev/edit#javascript,html . Can you link to an example showing the issue please?

    Allan
  • greengrassgreengrass Posts: 3Questions: 0Answers: 0
    Try this:
    [code]
    $(document).ready(function() {
    var t = $('#example').dataTable( {
    bScrollInfinite: true,
    sScrollY: 300,
    bScrollCollapse: true
    } );

    t.fnAddData( [1,2,3,4,5], false );
    t.fnAdjustColumnSizing();
    } );
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Interesting - this wasn't an expected use of fnAddData, since you are explicitly telling it not to redraw the table, but it expecting the table to update all the same. If you just remove the 'false' from fnAddData it works okay: http://live.datatables.net/ucefij/edit#javascript,html

    Having said that - there is most certainly something wrong with DataTables here since it is showing both the loading string and the new record - I would expect it to show only the loading since without a redraw. Added to my list to look at :-)

    Regards,
    Allan
  • greengrassgreengrass Posts: 3Questions: 0Answers: 0
    Ah, cool!

    To clarify, I was trying to optimize for speed when adding multiple rows by not having datatables redraw until after all new rows were added.

    fnAdjustColumnSizing() redraws the table by default, so I thought I was ok in deferring redraws until this function was called, but it sounds like I may have misunderstood the redrawing mechanism.
This discussion has been closed.