共享多个treepanels的树库

时间:2013-11-19 19:58:54

标签: extjs extjs4 treepanel

我有来自服务器的以下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"
    }
    ]
}

我有两个treepanels“stats”和“contacts”。我想用一个请求加载它们的内容。目前我的treepanels定义如下:

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”)与另一个root用户使用相同的树库。 有没有办法管理这个?

感谢您的回答。

0 个答案:

没有答案