Scroller, saveState and table resizing
Scroller, saveState and table resizing

Hello,
I wrote some code to resize the table automatically to fit the window. So far it works great with Scroller.
What does not work is the combination of: Scroller, saveState and table resizing.
I provide a minimal example based on the scroller serverside example here:
http://live.datatables.net/geniwiro/1/
As you can see in the example, when you run it, the table automatically resizes to fit the screen. You can then scroll around as usual. When you now re-run it, dataTables uses the saved state. But Scroller gets completely lost! An empty, or half-empty table is shown.
In my experiments/debugging on my own application I found that Scroller always believes that the current scrolling position is within the bounds of drawn content. So I need to scroll a while for it to actually reload data (and it looks like it then has everything right again). You can observe this effect in the minimal example.
I really have no clue at this point what is wrong with Scroller's internal state. Why is the initial positioning (loaded data vs scrolling position) off?
Thank you for any help!
Johannes
Answers
In the meantime I fixed another related problem with the AJAX fetch (do the first resize before, not after data loading).
I found that the problem has nothing to do with my custom resizing. In fact, this problem occurs with a stock Scroll + serverSide + stateSave setup.
The reason is that when scrolling without a reload, the state of Scroller is updated, but the state of the core is not. So the values "start" and "iScrollerTopRow" diverge. Scroller's sense of which rows are present and which are missing is then skewed when initializing from this inconsistent state.
A solution may be to always save a new 'start' when saving the state after scrolling, not only on new draws.