Scroller + bServerSide

Scroller + bServerSide

thooliethoolie Posts: 6Questions: 0Answers: 0
edited June 2011 in General
Hi!

I am trying to use following combination of features bServerSide + bScrollInfinite + Scroller plugin for virtual scrolling.
First two features (bServerSide and bScrollInfinite) work just fine. However when I try to include Scroller plugin in this combo "pagination" breaks down.

i.e. On initail page load table tries to load 3 rows although iDisplayLength is set to 10.

Is Scroller plugin even compatible with server side processing? Or I am just doing something wrong?

thanks in advance.

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Scroller is not compatible with infinite scrolling (actually it basically replaces / deprecates infinite scrolling...) - so if you want to use Scroller, disable infinite scrolling. There is an example of using Scroller with server-side processing here: http://datatables.net/release-datatables/extras/Scroller/server-side_processing.html (sorry about the 404 on the Scroller examples link - I'll fix that when I get home - this will work though to get all the examples: http://datatables.net/release-datatables/extras/Scroller/server-side_processing.html ).

    Scroller is yet to be properly "announced" - although it is released. I'll be writing up a few details about Scroller in the next couple of days.

    Allan
  • thooliethoolie Posts: 6Questions: 0Answers: 0
    Thank you for clarification. This should make thing easier.

    Unfortunately I am still facing the same problem.

    In the first request iDisplayLength is 3. I can't find any reason for this behaviour :(.

    I tryied to replicate your serverside based example but with same disapointing result.

    btw. this will be killer feature.... once I manage to figure it out.
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    The height of the scrolling viewport might be very small (that's the only reason I can think of without seeing it). Is it initialised when hidden, as that would likely do it? Scroller tries to work out the number of rows to show based on the viewport height.

    Allan
  • thooliethoolie Posts: 6Questions: 0Answers: 0
    I figured out that the problem was in row/viewport height.

    -> Scroller.js line 314 -> [code]this.s.dt._iDisplayLength = this.s.viewportRows * 3; [/code]

    That is why I am getting only three rows :)

    I am guessing that my table styling is somehow messing up calculations of row height and number.
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Yup - sounds like it might be sensible to have the option to override that calculation with an init option. Note made... You could just change that line in the source for now though.

    Allan
  • thooliethoolie Posts: 6Questions: 0Answers: 0
    Allan thanx.

    I believe I can now figure some temporary workaround.

    Can you tell me how to (in case if possible) acquire all nodes in table with scroller attached?

    What a I really need is ability to select rows via checkbox in first column( and consequently select all those checkboxes
    via check box in header).
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    http://datatables.net/api#fnGetNodes - however it will give you only the nodes which are currently rendered - since DataTables doesn't know about any other nodes, which might be something you hit with server-side processing.

    Allan
  • thooliethoolie Posts: 6Questions: 0Answers: 0
    Heh, I was afraid of of that.

    That is why I wanted to combine Scroller with infinite scroling in the first place.

    Idea was to load data while scrolling and than use Scroller functionality to render only rows that should be visible.
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    But wouldn't that have the same issue - only rows which have been created would have nodes available.

    Allan
  • thooliethoolie Posts: 6Questions: 0Answers: 0
    Not quite.

    I was aiming for case when user sequentially loads data while scrolling downwards (whit out skipping any rows).
    In that case you would have long array of loaded data (infinite scroll) but just part of that data rendered (Scroller)

    We have such implementation in place via custom solution and i t works fine for 1000 or so rows, but now we are starting to run into problems because table data is appended in form of html so after a while browser crumbles under gigantic table.
  • jenseralmeidajenseralmeida Posts: 1Questions: 0Answers: 0
    I just has the same trouble with the viewport and height(). I solve it replacing my old jquery-1.3.2 by a newer version (1.6.4)
This discussion has been closed.