Ext JS 4.2.1: perdió la posición de desplazamiento al cambiar entre pestañas

I have one tab, and let me called it tab A. The user are seeing some content in this tab, and maybe scroll to any position as they wanted. And for some business, they right click the button in the page of tab A and create a new tab, let me call it tab B. And once they return to tab A, the scroll position has been reset and the scroll position is on the top.

Ext.define('AppView', {
    extend: 'Ext.Component',
    maxHeight: 300,
});

var createTab = function (tabName, panelName){
    return {xtype: 'container',
        title: tabName,
        autoScroll: true,
        layout: {
            type: 'vbox',
            align: 'stretch'
        },
        items: [
            {
                title: panelName,
                items: [Ext.create( 'AppView' )]
            }
        ]
    };
};

var tabPanel = new Ext.tab.Panel({
    renderTo: 'testDiv',
    flex: 1,
    border: false,
    itemId: 'tabPanel',
    items: [createTab('First Tab', 'First Panel'),
        createTab('Second Tab', 'Second Panel')]
});

preguntado el 02 de diciembre de 13 a las 08:12

1 Respuestas

When a tab is closed, by default, it is destroyed, and recreated again when it gets activated.

To deactivate this behavior, set autoDestroy: false, como se explica en la documentación.

I hope this is enough to keep the scolling position. Your code would look like :

var createTab = function (tabName, panelName){
    return {xtype: 'container',
        title: tabName,
        autoDestroy: false,
        autoScroll: true,

Respondido el 02 de diciembre de 13 a las 08:12

But I didn't close any tab, I just open a new tab from a existing tab. And go to the new tab to see or to check something according to business. After that, I return to the former tab, and the scroll position has been reset. Thank you anyway, Meyer. - Alex

You're right I didn't read well. In my app I also have a similar configuration. In my case, the scroll position is not reset, but I'm not using a container con vbox layout, but grid panels. - lorenz meyer

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.