Consider the code like this and notice the config
property.
Ext.define('TouchTomatoes.view.WelcomeOverlay', {
extend: 'Ext.Panel',
xtype: "main",
config: {
cls: "welcomeOverlay",
html: [
"<div class='message'>",
"<h2>Welcome to <em>Touch Tomatoes</em></h2>",
"<p>Browse any of our lists by selecting a tab at the bottom, or swiping across the app. <br/>You can find a movie in our search section.</p>",
"<div class='tap'>Tap anywhere to begin</div>",
"</div>"
].join(""),
hidden:true
},
initialize: function() {
this.element.on({
tap: {
fn: function() {
this.hide();
},
single:true,
scope:this
}
})
}
});
Until now I would simply place config items directly into a class definition, and everything would work. Actually I was thinking that it is the only way to do it (since config
property is not documented in API for example). Can anyone tell how is one way different from another?
The same thing goes for initialize
method there, I would usually use initComponent
for this, why so many alternative names and ways in ExtJS?