PDA

View Full Version : Problem with two treepanel with same store - help needed



renganathan
29 Oct 2011, 6:51 AM
Hi everyone,

i am using two tree panels using same store . The tree nodes are visible in both the panels, when accordion is expanded , but only the last tree panel tree nodes are expanded up to the leaf node. The first tree panel nodes are not expanded.

But if i use different tree stores, the tree nodes are expanded correctly up to the leaf node.

This seems to be a bug but can you guys suggest if there is any workaround for this problem?

i have shared my code for tree store , panels & accordion




// tree store

var lab = "";
var org = "";
var ipaddr = "";
var treestore = Ext.create('Ext.data.TreeStore',
{
autoLoad : true,
proxy :
{
type : 'ajax',
url : 'labtree.php',
actionMethods: { create: 'POST', destroy: 'DELETE', read: 'POST', update: 'POST'}
},
root :
{
id : '0',
expanded : true
}
});









// 1st tree panel
var profileTree = new Ext.tree.TreePanel(
{
title : 'My Profile',
id : 'profileTree',
lines : true,
containerScroll : true,
autoScroll : true,
frame :true,
store : treestore,
rootVisible : false,
stateful : false,
listeners :
{
itemclick : function clickListener (view, rec, item, index, eventObj)
{
lab = rec.raw.chain['lab'];
org = rec.raw.chain['org'];
ipaddr = rec.raw.chain['ipaddr'];

dstore.load(
{
params:
{
lab : lab,
org : org,
ipaddr : ipaddr,
start : 0
}
});
Ext.getCmp('gridPan').getView().refresh();
}
}
});

// second tree panel
var navTree = new Ext.tree.TreePanel(
{
title : 'My Selected Labs',
id : 'navTree',
lines : true,
containerScroll : true,
autoScroll : true,
frame :true,
store : treestore,
stateful : false,
rootVisible : false,
listeners :
{
itemclick : function clickListener (view, rec, item, index, eventObj)
{
lab = rec.raw.chain['lab'];
org = rec.raw.chain['org'];
ipaddr = rec.raw.chain['ipaddr'];

dstore.load(
{
params:
{
lab : lab,
org : org,
ipaddr : ipaddr,
start : 0
}
});
Ext.getCmp('gridPan').getView().refresh();
}
}
});

//accordion
var navPanel = new Ext.Panel(
{
split :true,
title : "nav panel",
layout :'accordion',
items : [navTree, profileTree]
});



Your help will be appreciated

Thanks in advance

Gummy
2 Nov 2011, 11:53 PM
I have the same problem, it seems you can't use the same treestore for different treepanels.

See other peoples having the same problem here http://www.sencha.com/forum/showthread.php?136806
And here: http://www.sencha.com/forum/showthread.php?131162

If anybody has a nice solution to have 2 treepanels sharing the same underlying data, please share :)

It may be fixed in 4.1: http://www.sencha.com/forum/showthread.php?141390