Extjs 为多个树面板共享一个树孔

Extjs 为多个树面板共享一个树孔,extjs,extjs4,treepanel,Extjs,Extjs4,Treepanel,我从服务器收到以下JSON回复: { "stats": [ { "text": "Home", "leaf": true, "dbName": "home" }, { "text": "Sveatlo", "expanded": false, "leaf": false, "dbName": "sveatlo", "children":

我从服务器收到以下JSON回复:

{
    "stats": [
    {
        "text": "Home",
        "leaf": true,
        "dbName": "home"
    },
    {
        "text": "Sveatlo",
        "expanded": false,
        "leaf": false,
        "dbName": "sveatlo",
        "children": [
            {
                "text": "Vydané faktúry",
                "leaf": true,
                "dbName": "vydane-faktury"
            },
            {
                "text": "Prijaté faktúry",
                "leaf": true,
                "dbName": "prijate-faktury"
            }
        ]
    },
    {
        "text": "Hájočka",
        "expanded": false,
        "leaf": false,
        "dbName": "hajocka",
        "children": [
            {
                "text": "Vydané faktúry",
                "leaf": true,
                "dbName": "vydane-faktury"
            },
            {
                "text": "Prijaté faktúry",
                "leaf": true,
                "dbName": "prijate-faktury"
            }
        ]
    }
    ],
    "success": true,
    "contacts": [
    {
        "text": "Address book",
        "leaf": true,
        "dbName": "addressbook"
    },
    {
        "text": "Contacts",
        "leaf": true,
        "dbName": "contacts"
    }
    ]
}
我有两个树形面板“stats”和“contacts”。我想用一个请求加载这两个文件的内容。目前,我的树面板的定义如下所示:

items: [{
    xtype: 'treepanel',
    title: 'Statistics',
    id: 'statsMenu',
    store: Ext.getStore('MenuStats').load({
        params: {
            auth: sessionStorage.authSessionId,
            hostname: sessionStorage.hostname
        }
    }),
    rootVisible: false,
}{
    xtype: 'treepanel',
    title: 'Contacts',
    id: 'contactsMenu',
    store: Ext.getStore('MenuContacts'),
    rootVisible: false,
}]
但是我希望第二个treepanel(“Contacts”)使用同一个treestore,只使用另一个根。 有什么办法来处理这个问题吗


感谢您的回答。

再次深入阅读您的代码后,我意识到我的答案不正确。不可能用一个请求在两个存储中加载数据,并且使用给定的json结构,我认为不可能在一个存储中加载所有数据。再次感谢您的回答,我想我需要重建它。