PDA

View Full Version : Expanding/Collapising panel moving the scroll bar to the top of the window.



Rockz
9 Nov 2012, 5:02 AM
Hi All,

I have a panel in a window in my application which is adding some other collapsible panels as the child items dynamicaaly based on the store data.The Panel grows in height accordingly to the data and when there is enough data the browser correctly renders a scrollbar.But when I then scroll down a bit and expand or collapse a group the browser goes back to the top of the page.




Any suggestion is highly appreciated.



Thanks
Rockz

Alexander Bauer
4 Dec 2012, 6:37 AM
Hi, I have the same issue... does anybody has a hint ?

Alexander Bauer
5 Dec 2012, 9:25 AM
ExtJS 4.1
I could narrow down the issue to the following function:



Ext.override(Ext.panel.Header, {
setTitle: function(title) {
var me = this,
titleCmp = me.titleCmp;

me.title = title;
if (titleCmp.rendered) {
titleCmp.textEl.update(me.title || ' ');
// titleCmp.updateLayout();
} else {
me.titleCmp.on({
render: function() {
me.setTitle(title);
},
single: true
});
}
}
});

due to the updateLayout(); function, the scrollBar jumps to the top. Therefore whenever the title of the panel was changed, the scroll bar jumped to the top.
I just did an override and commented the updateLayout(); out, hopefully it will not affect other behavior.