ExtJs Model Alias

I have a definition of my model. Here:

Ext.define('KP.model.account.AccountList', { extend: 'Ext.data.Model', alias: 'model.d_AccountList', fields: ['key', 'number', 'personal_account', 'full_name', 'adress', 'pu'] }); 

So, I want to create this model by an alias . Or define a repository to use this model as follows:

 model: 'd_AccountList' 

How can i do this? Thanks!

PS: Maybe my nickname is wrong ...

+4
source share
3 answers

As far as I know, no.

0
source

I think you cannot create an alias for the model, there is no alias property in Ext.data.Model.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Model

 Ext.define('model.d_AccountList', { extend: 'Ext.data.Model', fields: ['key', 'number', 'personal_account', 'full_name', 'adress', 'pu'] }); var accountList = Ext.Create('model.d_AccountList', { key: 11, number: 33, personal_account: 4553463 }) 
0
source

People,

The 'alias' element exists for all ExtJS classes that inherit from Ext.Class. This includes models. You can use any alias you want if it does not collide with others. Best if you split them by domain. There are already some domains, such as "widget", "store", "proxy". If you need to specify a domain or a full alias, it depends on the class instance when using the alias configuration. For example, if you are referring to a proxy with the alias "proxy.myProxyAlias" in the store you should use: proxies: 'myProxyAlias' The reason is that the class Ext.data.Store will automatically pre-proxy. There are several others that do the exact same trick:

  • association reader definition
  • definition of 'writer' / 'reader' from proxy
  • definition of "reader" from the form
  • axis / series definition from chart
  • definition of "proxy" / other "store" from the store
  • widget definition

In your case, what you use really gives you this trick for model classes, so if you define a model with an alias: alias: 'model.myModel' in the store, you will need to use either the fully qualified name of the model class or: xtype: ' model.myModel '

Hope this helps.

0
source

Source: https://habr.com/ru/post/1437992/


All Articles