Scroller 'loads' half or some other amount of total, randomly.

Scroller 'loads' half or some other amount of total, randomly.

btBillbtBill Posts: 31Questions: 0Answers: 0
edited July 2013 in General
I am using the 1.1.1-dev version of scroller (because I have to use 1.10-dev of DT)

Anyway, I have 114 records total that need to be loaded.
If i clear cache and load the page, I get

"Showing 1 to 72 of 114 records." and my table only shows 7 rows at a time.

If I refresh the page, I get

"Showing 1 to 114 of 114 records"

There are other issues too like when I only get the "1 to 72 of 114" If i click my 'seelct all ' button, only the first 72 show as selected and the count for the selected ones decreases when I scroll down.

Any ideas on what is going on and why this is random?

All my rows are the same height, and the table stops scrolling at the end correctly, but the "Showing X of Y" is always wonrg.

I tried setting the 'iDisplayLength' but that didnt make any difference (actually, it said "Showing 1 to 90 of 114" this time, but I've seen that before, so not sure)

Thanks.

Replies

  • btBillbtBill Posts: 31Questions: 0Answers: 0
    A little more background on this now...

    There is def something weird with the scroller: 1.1.1-dev . The count is off for the initial rows counted and then the amount that shows up.

    I had to comment out the '$(n[i]).html( sOut ); ' in the _fnInfo function in scroller as this was not allowing my custom fnInfoCallback to run. When I did this though I now realize that the count became really off.. where this problem is coming from.

    When I uncomment out the same line, the count is closer.... shows '1to 13 of 114' , but my callback for selected records does not work.

    According to the docs, this _fnInfo in scroller 'replaces' the main one, but unfortunately it does not call my fnInfoCallback until the rows are filtered.

    Please advise on if there are any further developments or improvemets on the versions I am using.

    Thanks.
  • btBillbtBill Posts: 31Questions: 0Answers: 0
    Getting closer....

    So in the scroller, in the '"_fnCalcRowHeight" function, if I comment out

    // this.s.rowHeight = $('tbody tr', nTable).outerHeight();

    and set the height there:

    this.s.rowHeight = 36;

    the 'X to Y of Z' shows the correct count.
    I also tried setting the outerHeight to include the margin " $('tbody tr', nTable).outerHeight(true); " but that didnt work.

    Where / When is the height being retrieved from? I guess DT needs to know this before processing... and I think we have CSS being applied to the table after it renders.
  • btBillbtBill Posts: 31Questions: 0Answers: 0
    OK, found the

    "oScroller": {
    "rowHeight": 30
    }

    setting for scroller. This is workign now, but the ending seems to be wrong.
    Says: 'Showing 110 to 114 of 114' when it should be 'Showing 108 to 114 of 114'

    Need to figure out the issue with the sInfo now.
  • btBillbtBill Posts: 31Questions: 0Answers: 0
    OK, so it seems that the fnInfoCallback is immediately overwritten by the fnInfo in the scroller.
    I can see the one in the init being called if i increase the timeout on the scroller firing the fnInfo.

    So in order to get the 'X Selected' text to show up, I had to add the count in the _fnInfo in the scroller.


    Also, to fix (i think) the weird number of rows loading, I had to adjust the 'displayBuffer' up to my serverside processing threshold.


    Now I need to be able to clear checked input boxes on filtering a column.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Rather annoyingly, Scroller does its own thing for the information callback, which is why your custom one isn't being called: https://github.com/DataTables/Scroller/blob/master/media/js/dataTables.scroller.js#L662 .

    That's wrong I'd say - I think I did it that way because of a limitation with DT 1.9, but also I think I might have addressed that now, or at least be able to work around it a bit more cleverly in 1.10.

    I'll take a look and see what changes I can make to Scroller later in the week. Thanks for flagging this up.

    Regarding the height issue - it would be very helpful if you could link us to a test case showing the issue please.

    Allan
This discussion has been closed.