Can't get Scroller to work with Server Side Processing

Can't get Scroller to work with Server Side Processing

lorvaklorvak Posts: 1Questions: 0Answers: 0
edited June 2012 in Plug-ins
Hi, I'm trying to use the Scroller (1.0.2) plugin with server side processing. There will be up to 20,000 records and I want to load X records at page load, then more when the user scrolls down.

The problem I'm having is that the request never seems to be issued to fetch more records when the scroll bar reaches the bottom. If I sort or filter, it correctly sorts/filters for all records in the set. So, the whole data set is there, but I can't seem to get the Scroller working.

my page has the following:
[code]


jQuery(document).ready(function() {
jQuery('#auth_users_table').dataTable( {
"sScrollY": "400px",
"sAjaxSource": "../update_auth_users_table_data/" + <%= customer_id.to_s %>,
"bServerSide": true,
"sDom": "frtiS"
} );
} );

[/code]


this hits a ruby controller to fetch records. I put some extra logging into the Scroller javascript, and I see that the redraw never happens because
[code]
if ( iTopRow != this.s.dt._iDisplayStart )
[/code]

never evaluates true. iTopRow and this.s.dt._iDisplayStart are always 0 when this condition is evaluated.

Is there something else need to configure? why would iTopRow stay 0 as I scroll from top to bottom?

thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Scroller should work fine with server-side processing, as seen in this example: http://datatables.net/release-datatables/extras/Scroller/server-side_processing.html .

    Can you give me a link to a test case that shows the problem please?

    Allan
  • jcreadyjcready Posts: 44Questions: 0Answers: 0
    edited June 2012
    I was having a similar issue. This pull request solved it for me (not my code): https://github.com/DataTables/Scroller/pull/10/files

    You can get the code here: https://github.com/joshdick/Scroller/blob/master/media/js/Scroller.js

    You can see the discussion about the problem here: http://datatables.net/forums/discussion/9026/datatables-scroller-plugin-white-space-at-top-issue-and-fix-provided
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Thanks very much for pointing that out. I'll dig into that properly and get the patch included in Scroller core.

    Allan
  • lorvaklorvak Posts: 1Questions: 0Answers: 0
    hi, thanks for the replies.
    I now have the following problem:
    1) no datatables params are attached to the server side processing request at load.
    2) the table does redraw when I move the scroll bar ("Scroll forcing redraw - top DT render...") but no new request is submitted.

    allan, I set up an example with your code at:
    http://scrollertest.comule.com
    (Scroller trace logging is on)

    It's calling 2500.php, which is just returning the entirety of your 2500.txt JSON (the hosting provider seems to block .txt).

    I see the request at load as:
    [code]
    http://scrollertest.comule.com/media/data/2500.php?_=1339165768867
    [/code]

    where are the rest of the params? In your example, I see the request as:
    [code]
    http://datatables.net/release-datatables/extras/Scroller/media/data/server_processing.php?sEcho=14&iColumns=5&sColumns=&iDisplayStart=5398&iDisplayLength=27&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&iSortCol_0=0&sSortDir_0=asc&iSortingCols=1&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&_=1339165120714
    [/code]

    Since this example always returns all 2500 records the params aren't actually used, but in my implementation the ruby controller needs them to construct the query. I expect if I can get the requests looking correct in this example then I can get my implementation working as well.

    thanks again!
This discussion has been closed.