0

有人可以帮我解决我的问题吗?

我创建了一个模型并将别名设置为该模型,并在其中使用相同Ext.data.store的别名并将模型设置为别名,但它不起作用,但使用模型的完整名称它可以工作。为什么?

Ext.define('lancet.asset.system.combobox.models.PathwayModel', { extend: 'lancet.def.system.model.Model', alias: 'widget.pathwaymodel', fields: [ { name: 'Id', type: 'string' }, { name: 'Name', type: 'string' }, { name: 'group', type: 'string' } ] });


Ext.create('Ext.data.Store', { model: 'lancet.asset.system.combobox.models.PathwayModel',//it's work autoLoad: true }


Ext.create('Ext.data.Store',{ model:'PathwayModel',//it doesn't work autoLoad:true}
4

1 回答 1

0

Look at the documentation:

Name of the Model associated with this store. The string is used as an argument for Ext.ModelManager.getModel.

I expects a name, not an alias so thats the reason it works only with a name.

If you want to create a custom store that accepts the model as an alias you can do it using getNameByAlias() (but I guess you'd like to use a diffrent prefix and not widget).

于 2013-05-20T11:45:05.393 回答