Reputation: 113
I am trying to retain the position of the scrollbar in formpanel to show after form refresh .
But i am unable to find any solution.Please help me by suggesting solution for this.
Thanks & Regards
Sumanth K.P
Upvotes: 0
Views: 822
Reputation: 1
1-Before refreshing the panel, put the scroll position in the variable.
var scrollposition = form.body.dom.scrollTop;
2-So, refresh the content of the form and make the scroll position equal to the value of the previous position.
form.body.dom.scrollTop = scrollposition ;
Upvotes: 0
Reputation: 1220
I had a similar problem with a grid panel in IE, where on a refresh the grid would scroll to the start of the grid. The solution was to add the following function to the grid panel:
fixIeScrollPosition: function() {
console.log("fix ie scroll position ");
var scrollTarget = this.getScrollTarget();
var currentScrollPosition = scrollTarget.getEl().getScroll().top;
var expectedScrollPosition = scrollTarget.bufferedRenderer.scrollTop;
var correction = expectedScrollPosition - currentScrollPosition; // will be 0 in non-IE
scrollTarget.scrollBy(0,correction);
},
This is triggered by refresh events.
Upvotes: 0