SensacionRC
SensacionRC

Reputation: 615

ExtJS 4.2 scrollbars of infinite grid

I have a tab panel,the last tab of that tab panel has a infinite grid(that works perfect),this grid has autoScroll set to true,and when the store of the grid is loades in the grid appear a scroll bar on the right and other at the bottom. I can navigate with the scroll bars perfect but for example if I put the bottom scroll bar in the middle,go to another tab and return to this(every time I go to a tab I reload the store/stores of its components),the bottom scroll bar is in the same position and I want it to go to the start position:

My bottom scroll bar state is:

enter image description here

And when I return to the tab I want it like:

enter image description here

Is there a way to do that??

Upvotes: 0

Views: 121

Answers (1)

Tyr
Tyr

Reputation: 2810

You can use the tabs listener beforeActivate to reset the scroll position for the grid:

listeners: {
    beforeActivate: function() {
        // Reset scroll position
          this.down('gridpanel').getView().getEl().scrollTo('left', 0, true);
    }
}

Working example: https://fiddle.sencha.com/#fiddle/19q4

Upvotes: 1

Related Questions