All_Safe
All_Safe

Reputation: 1399

ExtJS data store don't work with short name model

I have this code:

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
                }]
            }
        }
    }
});

It doesnt work.

If I change model: 'MainMenu', to model: 'Operations.model.MainMenu', it works! Mystic! Why it happens? Why does he require you to specify the full name? This is the only place I have where it happens.

I use Sencha ExtJS 6.0.2 Classic

Upvotes: 0

Views: 55

Answers (1)

Merlin Attila Fejzuli
Merlin Attila Fejzuli

Reputation: 655

Models do not support aliases, so you need to specify the full name.


Aliases are written in the format namespace.name.
Supported namespaces are (the documentation is very vague on this, so there could be more):

  • feature
  • plugin
  • store
  • widget
  • controller
  • viewmodel

Upvotes: 1

Related Questions