ExtJS数据存储不适用于短名称模型

问题描述 投票:0回答:1

我有这个代码:

Ext.define('Operations.view.main.menu.MainMenuModel', {

    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.mainmenu',

    requires: [
        'Ext.data.TreeStore',
        'Operations.data.schema.TreeSchema',
        'Operations.model.MainMenu'
    ],

    schema: 'tree',

    stores: {
        mainMenuStore: {
            type: 'tree',
            model: 'MainMenu',
            root: {
                expanded: true,
                children: [{
                    text: 'Operations',
                    iconCls: 'x-fa fa-home',
                    leaf: true
                }]
            }
        }
    }
});

它不起作用。

如果我将model: 'MainMenu',改为model: 'Operations.model.MainMenu',,那就行了!神秘!为什么会这样?他为什么要求你指定全名?这是我遇到的唯一地方。

我用Sencha ExtJS 6.0.2 Classic

extjs extjs5
1个回答
1
投票

模型不支持别名,因此您需要指定全名。


别名以namespace.name格式编写。 支持的命名空间(文档对此非常模糊,因此可能会有更多):

  • 特征
  • 插入
  • 商店
  • 小部件
  • 调节器
  • 视图模型
© www.soinside.com 2019 - 2024. All rights reserved.