【问题标题】:Build TreePanel in ExtJs在 ExtJs 中构建 TreePanel
【发布时间】:2019-03-11 20:25:26
【问题描述】:

当请求时,服务器返回这样一个复杂的对象。内容其实要多得多,但本质是清楚的,有对象和他们的孩子。

{"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,
});

【问题讨论】:

    标签: extjs extjs6-classic treepanel


    【解决方案1】:

    使用parentIdProperty 加载包含对父级的引用的平面列表。在你的情况下,它应该是:

    parentIdProperty: 'parentID'

    【讨论】:

    • 谢谢你,它帮助了我。
    猜你喜欢
    • 1970-01-01
    • 2013-06-09
    • 2013-07-07
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多