PDA

View Full Version : Treepnel issue in ExtJs4



swiji2000
21 Jun 2012, 8:15 PM
Hi,

I am facing one issue when using tree panel with MVC Pattern as when I open TreePnel in first time treepanel expand collapse operation working properly but I open some other pages and again open treepanel in second time its expand or collapse operation not working properly [children not showing].

Give some idea how to solve this issue.

Thanks.

scottmartin
22 Jun 2012, 10:28 AM
Please present a small working test case that demonstrates this problem. It sounds like there is a problem in your code, as this should not be happening.

Scott

swiji2000
8 Aug 2012, 2:09 AM
Hi,

here is the code,



Ext.define('treeContainer', {
extend: 'Ext.container.Container',
alias: 'widget.treeContainer',
height: '100%',
width: '100%',
id : 'treeContainerId',
layout: {
type: 'border'
},
initComponent: function(){
var me = this;
Ext.applyIf(me, {
items: [{
xtype: 'panel',
ariaRole:'main',
region: 'center',
id: 'centerPanel',
height: '80%',
layout: 'fit',
items: Ext.create('view.Portal')
}, {
xtype: 'customerImagePanel',
ariaRole:'banner',
height: '10%',
width: '100%',
region: 'north'

}, {
xtype: 'panel',
ariaRole:'navigation',
width: '17%',
id: 'leftPanelId',
collapseDirection: 'right',
collapsible: true,
region: 'west',
layout: 'fit',
items: [{
xtype: 'treepanel',
id: 'treeId',
autoScroll: true,
alias: 'widget.treeId',

root: '',

viewConfig: {}
}]
}]
});
me.callParent(arguments);
}


});


In controler.js



Ext.getCmp('treeId').setRootNode(peopleTree);
Ext.getCmp('treeId').show();


and,



var peopleTree = {
text: 'People',
id: 'peopleTreePanel',
expanded: true,
children: [{
text: 'Child1',
leaf: true,
id: 'child1'
}, {
text: 'Child2',
leaf: true,
id: 'child2'
}, {
text: 'Child3',
leaf: true,
id: 'child3'

}]
}

scottmartin
8 Aug 2012, 6:18 AM
In your description I see the issue is when you open again .. try removing 'id' from component



// id : 'treeContainerId',


See if this helps.

Scott.

swiji2000
8 Aug 2012, 10:07 PM
Its not working Scott.

swiji2000
9 Aug 2012, 2:46 AM
HI,
Treepanel root and childs not rendering in second time. First time its working fine.

Please suggest what is the issue on it.

Thanks in Advance