树的孩子现在在extjs中显示

时间:2016-01-14 20:17:40

标签: tree extjs5

只显示了我的extjs树(这里是Car)的根元素,但我无法弄清楚原因。我使用树存储来表示数据,使用TreePanel来显示它。我的Ext-js版本是5.1。我试用了Firefox和Internet-Explorer,结果相同。欢迎任何帮助。

我的商店:

printf

我的模特:

Ext.define('Example.store.DynamicCarStore', {
    extend: "Ext.data.TreeStore",
    model: 'Example.model.DynamicCarModel',
    root: {
        text: 'Root',
        expanded: true
    }
});
小组:

Ext.define("Example.model.DynamicCarModel", {
    extend: 'Ext.data.Model',
     fields: [{
        name: 'CarModel',
        type: 'string'
    }],

    proxy: {
        type: 'ajax',
        url: 'http://localhost:8080/WebTestExtJs2/example/example/test/',
        actionMethods: {
            read: 'GET'
        },
        reader: {
            type: 'json',
            root: 'children' 
        },
    },    
});

和我从服务器上读取的json数据:

Ext.define('Example.view.DynamicTreePanel', {
    extend: 'Ext.tree.Panel',
    title: 'Dynamic Car Simple Tree ',
    width: 200,
    height: 150,
    store: null,
    constructor: function(config)
    {
        this.store=Ext.create("Example.store.DynamicCarStore");
        this.superclass.constructor.call(this,config);
    },
    rootVisible: true,
    lines: true, // will show lines to display hierarchy.    
    useArrows: true, //this is a cool feature - converts the + signs     into Windows-7 like arrows. "lines" will not be displayed
    renderTo: Ext.getBody(),
    columns: [{
        xtype: 'treecolumn',
        dataIndex: 'name' // value field which will be displayed on    screen   
}]
});

0 个答案:

没有答案
相关问题