Ext JS 4.2.1: perdió la posición de desplazamiento al cambiar entre pestañas
Frecuentes
Visto 724 veces
2
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')]
});
1 Respuestas
1
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
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas extjs tabs scroll switch-statement or haz tu propia pregunta.
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
convbox
layout, but grid panels. - lorenz meyer