EXTJS4:嵌入TreeView时未加载应用程序

时间:2013-06-12 07:36:23

标签: javascript model-view-controller extjs4 treeview

如果没有嵌入TreeView“TreeCreateMenu”,我的应用程序工作正常。由于它是嵌入式的,因此应用程序在extjs目录“Trigger.js”的Point的Browser-Web-Console中存储。但是没有显示错误!

以下是我的文件:

视口:

Ext.define('App.view.Viewport', {
    extend: 'Ext.container.Viewport',
    requires: [
        'App.view.Settings',
        'App.view.Footer',
        'App.view.TreeMenu',
        'App.view.tree.TreeCreateMenu',
    ],

    layout: 'border',

    items: [
        {
            region: 'north',
            border: false,
            margin: '0 0 1 0',
            split: true,
            items: [{xtype: 'settings'}]
        }, {
            region: 'west',
            collapsible: true,
            title: 'Menu',
            width: 250,
            layout: 'vbox',
            items: [
                {
                    xtype: 'treemenu',
                    height: 600,
                    minSize: 600,
                    maxSize: 600,
                    layout: 'fit',                  
                    flex: 1
                },
                {
                    title: 'Create',
                    layout: 'fit',
                    border: '1 0 0 0',
                    width: 250,
                    height: 100,
                    items: [{xtype: 'treecreatemenu'}]
                }
            ]
            // could use a TreePanel or AccordionLayout for navigational items
        }, {
            region: 'south',
            layout: 'fit',
            height: 20,
            items: [{xtype: 'footertoolbar'}]
        }, {
            region: 'center',
            id:'region_center',
            layout: 'fit',
            border: '1 0 0 0',
            items: []
        }
    ],

    initComponent: function() {
        this.callParent();
    }
});

TreeCreateMenu的控制器

Ext.define('App.controller.tree.TreeCreateMenu', {
    extend: 'Ext.app.Controller',
    views: ['tree.TreeCreateMenu'],
    models: ['tree.TreeCreateMenu'],   
    stores: ['tree.TreeCreateMenu'],
    onLaunch: function() {},
    refs: [{
        selector: 'tree',
        ref: 'treecreatemenu'
    }],
    init: function() {
        this.control({
            'treecreatemenu': {
                itemclick: function(view, node, rec, item, index, e ) {}
            }
        });
    }
});

型号:

Ext.define('App.model.tree.TreeCreateMenu', {
    extend: 'Ext.data.Model',
    displayField: 'text',
    fields: [
        {name: 'text', type: 'string', leaf:false},
        {name: 'value', type: 'string', leaf:false},
    ]
});

商店:(响应是正确的,因为我在Viwport的TreeMenu.js上显示了它)

Ext.define('App.store.tree.TreeCreateMenu', {
    extend: 'Ext.data.TreeStore',
    requires: 'App.model.tree.TreeCreateMenu',
    model: 'App.model.tree.TreeCreateMenu',
    AutoLoad: false,
    nodeParam: 'value',
    proxy: {
        type: 'ajax',
        url: 'bin/app/ajax.php',
        extraParams: {
            action:'getTreeCreateMenu'
        },
        reader: {
            type: 'json',
            root: 'children'
        },
        actionMethods: {
            create : 'POST',
            read   : 'POST',
            update : 'POST',
            destroy: 'POST'
        }
    }
});

我的观点

Ext.define('App.view.tree.TreeCreateMenu', {
    extend: 'Ext.tree.Panel',
    alias: 'widget.treecreatemenu',
    //store: 'tree.TreeCreateMenu',
    rootVisible: false,
    bodyStyle: 'border:none;',
    padding:'5,0,0,0'
});

所以没什么特别的......但它不起作用,我完全不知道!有人可以帮我这个吗?谢谢!

0 个答案:

没有答案