Problem with Scroller 1.2.0: Sometimes additional row data won't get loaded !?

Problem with Scroller 1.2.0: Sometimes additional row data won't get loaded !?

fjf2002fjf2002 Posts: 5Questions: 1Answers: 0
edited February 2014 in General
Hi Allan,

I've been working with datatables for over a year now and I appreciate your work. Great job!

Lately i stumbled into a problem I couldn't solve - perhaps you or someone other can help me - or if it should be a little error in Scroller: This could be my chance to contribute a bit :-)

The problem occurs very rarely. I could drill it down to the following minimal configuration:[code]
$(document).ready(function() {
$('#example').dataTable( {
sScrollY: "300px",
sDom: "frtiS",
bServerSide: true,
bPaginate: true,
iDeferLoading: [105, 105],
aaData: <100 lines of data>
}[/code]
(I uploaded the example also at http://live.datatables.net/hit/4/edit?html,js,output )

The key configuration seems to be:
a) The aaData aaray length is smaller than what iDeferLoading says (i. e. aaData is not complete - when scrolling, some data has to be fetched from the server)
b) The product of viewportRows and displayBuffer as calculated in scroller.js line 401:[code]
this.s.dt._iDisplayLength = this.s.viewportRows * this.s.displayBuffer;[/code]
is bigger than what iDeferLoading says (i. e. full number of rows).

When scrolling to a row where the row data hasn't yet been loaded, program execution comes to line 584:[code]
else if ( iTopRow + this.s.dt._iDisplayLength > this.s.dt.fnRecordsDisplay() ) {[/code]
iTopRow was slightly positive in my case (for example iTopRow=3), and fnRecordsDisplay() seems to return the total rows number (i. e. the number from iDeferLoading), so the condition above is satisfied and line 586[code]
iTopRow = this.s.dt.fnRecordsDisplay() - this.s.dt._iDisplayLength;[/code]
sets a negative value for iTopRow, which is later set to zero.
Because of line 598[code]
if ( iTopRow != this.s.dt._iDisplayStart ) {[/code]
additional row data never gets loaded.

I hope I explained by problem precisely enough; thank you in advance,

Franz-Josef

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Hi,

    Thanks very much for the test case and details! Your test case appears to work okay with DataTables 1.10: http://live.datatables.net/hit/6/edit .

    Could you possibly try 1.10 in your local table to see if that resolves the issue?

    Thanks,
    Allan
  • fjf2002fjf2002 Posts: 5Questions: 1Answers: 0
    Hi,

    thank you for your quick answer. I worked over both my local table and your test case:
    a) The problem in my local table is not solved when upgrading all JS files to your current 1.10 version.
    b) I think your test case with 1.10 works just because the row height is a bit more. Add a simple [code]

    table.dataTable tbody th, table.dataTable tbody td { padding: 0; }

    [/code]
    ... and the problem comes to your test case, too.
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Excellent - thanks for pointing that out. I'll try to take a look and see what is going wrong later on today.

    Allan
  • fjf2002fjf2002 Posts: 5Questions: 1Answers: 0
    Hi Allan,

    any news on this?

    Sincerely yours,
    fjf2002
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Sorry - time has run away from me. I'll try to look at this soon.

    Allan
This discussion has been closed.