Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ben Leah on Oct 22, 2009 03:46
open dhtmlx forum
Grid - How do set the horizontal scroll position after smart render

My sorting is performed on the server side. When I sort a column that is scrolled to the right of the grid, when the grid is reloaded the scroll position has been reset, how do I remember this after each sort?

Thanks.
Ben
Answer posted by dhxSupport on Oct 22, 2009 09:57
This issue confirmed. As a quick solution you can use:

mygrid.attachEvent("onXLS",function(){
this.scroll_left = mygrid.objBox.scrollLeft||0;
})
mygrid.attachEvent("onXLE",function(){
mygrid.objBox.scrollLeft = this.scroll_left||0;
})

Answer posted by Ben Leah on Oct 23, 2009 07:04
Thanks for your reply, however when I click on a column to sort the grid scrolls back to the zero position before the onXLS function is called therefore resulting in a scrollLeft  of zero everytime? (I have frozen columns enabled if this makes a difference)
Answer posted by Alex (support) on Oct 23, 2009 08:12

You can set onAfterSorting event handler that we will be called after the sorting:

grid.attachEvent("onAfterSorting",function(){

/*your code here*/

})