Save scroll positions

Hi



I want to save the scroll positions after page refresh.

I’m using dhtmlx grid 1.5 (build 71114) professional edition.



Thanks In Advance

The grid hasn’t API for such operation, but you can get state of scroll , save it to cookies and restore after refresh.

To get scroll position
    var h_scroll=grid.objBox.scrollLeft;
    var v_scroll=grid.objBox.scrollTop;

To restore after page reload
    grid.objBox.scrollLeft = h_scroll+“px”;

    grid.objBox.scrollTop = v_scroll+“px”;

Does the API have these yet?

This approach is actual for the latest grid version too.

This does not seem to work. mygrid.objBox.scrollTop always returns 0.

Ok I got grid.objBox.scrollTop to work, but when I set it, its not scrolling it down at all.

I am using smartrendering.


I am using smartrendering.
In  which moment you are calling related method?
If you are using dyn. srnd mode - the full length of grid will be init only when data about total count of rows retrieved. So you can try use code as


grid.load(url,function(){
        grid.objBox.scrollTop = some;
});