在ExtJs中构建TreePanel

时间:2019-03-11 10:08:40

标签: extjs extjs6-classic treepanel

当请求时,服务器返回这样的复杂对象。内容实际上更多,但本质很明确,有对象及其子对象。

{"data":
{"accesslist":
[{"id":1,"parentID":0,"groupName":"doctor","pointCode":"patient.view","pointName":"Patien data","pointDescription":"","children":
[{"id":2,"parentID":1,"groupName":"doctor","pointCode":"patient.personal.info","pointName":"Show patient data","pointDescription":""}]
}]
}
}

我需要将此对象放置在TreePanel中,请告诉我如何操作?

我尝试过,但是那样行不通。

var fullAccessCarribean = Ext.create('Ext.data.TreeStore', {
    proxy: {
        url: '/CardioService/securitymanager',
        method: 'post',
        type: 'ajax',
        extraParams:{
            mode: 'accesslist',
        },
        reader: {
            root: 'data.accesslist'
        }
    },
    root:{
        expanded: true,
    }
});


Ext.define('Ext.Modules.AdminGridForm.SettingsPanel.AccessPanel.AccessTreeGrid.AccessTreeGrid', {
    extend: 'Ext.tree.Panel',    
    alias: 'widget.accesstreegrid',

    flex: 1,

    layout: {
        type: 'hbox',
        align: 'stretch'
    },

    store: fullAccessCarribean,
});

1 个答案:

答案 0 :(得分:1)

使用parentIdProperty加载带有对父级引用的平面列表。您的情况应该是:

<dependency> <groupId>io.fabric8</groupId> <artifactId>kubernetes-client</artifactId> <version>4.1.3</version> </dependency>