Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nafis on Apr 11, 2008 11:36
open dhtmlx forum
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
Answer posted by Support on Apr 14, 2008 01:32
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";
Answer posted on Apr 24, 2009 18:48
Does the API have these yet?
Answer posted by Alex (support) on Apr 25, 2009 01:17
This approach is actual for the latest grid version too. 
Answer posted on Apr 25, 2009 12:20
This does not seem to work. mygrid.objBox.scrollTop always returns 0.
Answer posted on Apr 25, 2009 13:01
Ok I got grid.objBox.scrollTop to work, but when I set it, its not scrolling it down at all.

I am using smartrendering.


Answer posted by Support on Apr 27, 2009 09:58
>>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;
});