0
votes

When requested, the server returns such a complex object. The content is actually much more, but the essence is clear, there are objects and their children.

{"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":""}]
}]
}
}

I need to place this object in the TreePanel, tell me, please, how to do it?

I tried it, but it doesn't work that way.

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

1 Answers

1
votes

Use the parentIdProperty to load a flat list with references to the parent. In your case, it should be:

parentIdProperty: 'parentID'