Sencha Touch 2- Unable to get ref view from controller

巧了我就是萌 提交于 2019-12-06 07:13:33

refs - a collection of named ComponentQuery selectors that makes it easy to get references to key Components on your page.

According to http://docs.sencha.com/touch/2-0/#!/api/Ext.ComponentQuery (it is about types of selectors that you can use in "refs") components can be retrieved by using:

1) their xtype: 'panel', 'textfield' etc.

2) their id: '#idOfYourComponent'

In you case:

1) User Form

Ext.define(appName + '.view.user.UserForm', {
    extend  : 'Ext.form.FieldSet',
    xtype   : 'userForm' 
    alias   : 'widget.userform',

User Controller

Ext.define(appName + '.controller.UserController', {
    extend      : 'Ext.app.Controller',
    stores      : [ 'Users' ],
    models      : [ 'User' ],
    views       : [ 'user.UserList', 'user.UserForm' ],
    refs        : {
        mySuperMegaForm: 'userForm'
    }

2) User Form

Ext.define(appName + '.view.user.UserForm', {
    extend  : 'Ext.form.FieldSet',
    id   : 'userFormId' 
    alias   : 'widget.userform',

User Controller

Ext.define(appName + '.controller.UserController', {
    extend      : 'Ext.app.Controller',
    stores      : [ 'Users' ],
    models      : [ 'User' ],
    views       : [ 'user.UserList', 'user.UserForm' ],
    refs        : {
        mySuperMegaForm: '#userFormId'
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!