I'm just starting to build Sencha Touch 2 MVC. I have Ext 3 hard experience, but it's a whole new world.
It seems I'm not very far from creating a presentation. I took my code in two directions, based on what I saw on the Internet, and it doesn’t work.
Way 1
My app.js:
Ext.application({ name: 'BkAdmin', views: ['LoginForm'], launch: function() { Ext.create('BkAdmin.view.LoginForm'); } });
My view / LoginForm.js:
Ext.define('BkAdmin.view.LoginForm', { extend: 'Ext.form.FormPanel', config: { fullscreen: true, initComponent: function() { alert('yo!'); BkAdmin.view.LoginForm.superclass.initComponent.apply(this, arguments); } } } );
This loads without errors, and I can even add form elements in the configuration section. However, initComponent () is inexplicably never called, so the view is completely inflexible.
Way 2
My app.js:
Ext.application({ name: 'BkAdmin', views: ['LoginForm'], launch: function() { BkAdmin.view.LoginForm = new BkAdmin.view.LoginForm(); } });
My view / LoginForm.js:
BkAdmin.view.LoginForm = Ext.extend(Ext.form.FormPanel, { fullscreen: true, initComponent: function() { alert('yo!'); BkAdmin.view.LoginForm.superclass.initComponent.apply(this, arguments); } });
This plane does not work. Chrome reports "Cannot set property" LoginForm "from undefined" ... how did you actually view get undefined? He also says: “The following classes are not declared, even if their files have been loaded:“ BkAdmin.view.LoginForm. ”I am sure it seemed to me.
There are many questions: what did I do wrong in the above ways? How can I get initComponent () to call in path 1 and run Path 2? Which code is better to use quotation marks?
Thanks!