PDA

View Full Version : Problem async TreePanel load only the first time



bdom
13 Aug 2010, 12:12 AM
Hi there

I have a border Layout Viewport with a west panel which is an async treepanel.
The load of treepanel fails but only the first time, if I refresh my apply (F5) it works and all the nodes are populated ok.
I’ve been searching in forum but I didn’t found a solution. These threads maybe are related but it doesn’t work for me.

http://www.sencha.com/forum/showthread.php?72172-Problem-expanding-tree-in-border-layout&highlight=treepanel+async+viewport (http://www.sencha.com/forum/showthread.php?72172-Problem-expanding-tree-in-border-layout&highlight=treepanel+async+viewport)

http://www.sencha.com/forum/showthread.php?82131-nested-TreePanel-does-not-load&highlight=treepanel+async (http://www.sencha.com/forum/showthread.php?82131-nested-TreePanel-does-not-load&highlight=treepanel+async)

Thanks,

My code:



var pB_Arbol = {
nodeType: 'async',
dragable: false,
id:'rootPanel',
children: [{id: 'Municipios',text: 'Región de Murcia',cls: 'InicioTree'}]
};

var panelBusqueda = {
id: 'pnlArbol',
xtype: 'treepanel',
region: 'west',
width:250,
frame:true,
split: true,
title: 'Fichas de Ocupación',
useArrows: true,
autoScroll: true,
rootVisible: false,
enableDD: false,
dataUrl: 'obtener_datos.aspx?tipo=arbol_busqueda',
root: pB_Arbol,
listeners: {
click: function (n, e) {
//Se comprueba el tipo de información que se requiere
switch (n.id.split('#')[0]){
case 'idOcupacion':
if(idOcupacion != n.text){
idOcupacion =n.text
cargarFichaOcupacion();
//Zoom en mapa al elemento seleccionado
if (Ext.getCmp('panelCentral').getLayout().activeItem.id=="card-0"){
refrescarCapas(idOcupacion);
obtenerExtent(idOcupacion);
}
}
//Control de ficha activada
if (Ext.getCmp('panelCentral').getLayout().activeItem.id=="card-1" &&
Ext.getCmp('panelFichas').getLayout().activeItem.id=='cardFicha-1')
{
Ext.getCmp('card-prevFicha').handler();
Ext.getCmp('card-nextFicha').toggle(false);
}

break;
}
}
}
};

new Ext.Viewport({
layout: 'border',
items: [{
id: 'Cabecera',
region: 'north',
html: '<img src="imagenes/Cabecera.png" align=left><img src="imagenes/tragsatec.png" align=right >',
height:49,
bodyStyle: 'background:url(imagenes/background.png)',
layout:'anchor'
},
panelBusqueda,
new Ext.Panel({
id: 'panelCentral',
region: 'center',
layout:'card',
activeItem: 1,
tbar:tbTabs,
items: [pnlCentroVisor,pnlCentroFicha]
})
]
});