Considering the suggested alternatives, the most feasible option is resetting scroll position to 0 when sorting is applied: Code Snippet
However, the overall behaviour corresponds to our general principles of dynamic loading.
Server-side sorting is data reloading with certain parameters. When a Webix widget reloads data, the 1st request always starts at 0 position (also, when a component is initialized, the initial request can have no parameters at all - dynamic loading is enabled based on the first server response).
Sorting preserves scroll position (filterinig does the same if possible), and as a result, an additional request is made to load data at the visible area of the datatable.
The same can be observed if the scrollTo method is called with custom values (in pixels).
The start is not necessary a multiple of datafetch (50 by default) and depends on the current scroll position and on already loaded data items (so it can be 503, 506, etc.). Still, datafetch determines the size of expected portion of data.
With that said, when scrolling up from a certain position after sorting, start is decreasing by the datafetch value to avoid any gaps. If you scroll all the way to the top, the last request/response will include the existing data, but this won’t duplicate records - any incoming item with a matching ID will be treated as an update and won’t cause any conflicts.
I apologize for the late response and for any inconvinience caused by it.
First of all, thank you for the detailed reports.
why the request is sent: start=998&count=50&continue=true
scroll up should download the all previous page and set start = currentPos - datafetch(i.e:50)
I can confirm the bug, thank you!
It appears when scrolling by dragging a scrollbar (but not via mousewheel), so I’m assuming that our onscroll handler is triggered twice in this specific case (2nd time coordinates and/or direction could be mishandled - in that case, loader simply fetches the next possible portion towards the end of the dataset).
(NEW PROBLEM!!!) scroll by keyboard key “Up” doesn’t scroll the page up (just stop on the first list record)
Definitely a bug, thank you!
We’ll do our best to fix both issues in one of the nearest minor updates.