25. Ext.Class – Example 3
Statics
Ext.define ('PCCreator', { var dell = PCCreator.factory ('Dell');
statics: { var asus = PCCreator.factory ('Asus');
computerCounter: 0 , var hp = PCCreator.factory ('HP');
factory: function (name) {
return new this (name); Alert (dell.name);
} Alert (asus.name);
}, Alert (hp.name);
config: {
name: '' Alert (PCCreator.computerCounter);
},
constructor: function (cfg) {
this.initConfig (cfg);
this.self.computerCounter++;
return this;
}
});
License : Creative Commons (Attribution , Share Alike) 3.0 Generic
26. Ext.Loader
Ext.Loader is the heart of the new dynamic dependency loading
capability in Ext JS 4+. It is most commonly used via the Ext.require
shorthand. Ext.Loader supports both asynchronous and synchronous
loading approaches.
Asynchronous Loading
Advantages
Cross-domain Hybrid Solution?
No web server needed Yes, we can!
Best possible debugging
Disadvantages
Dependencies need to be specified before-hand
Synchronous Loading on Demand
Advantages
There's no need to specify dependencies before-hand
Disadvantages
Not as good debugging experience
Must be from the same domain due to XHR restriction
Need a web server
License : Creative Commons (Attribution , Share Alike) 3.0 Generic
27. Requirements
Web Browsers
Google Chrome 10+
Apple Safari 5+
Mozilla Firefox 4+
Web Server (is not a requirement but is highly recommended)
Apache (recommended)
ExtJS 4 SDK
Download at http://www.sencha.com/products/extjs
License : Creative Commons (Attribution , Share Alike) 3.0 Generic
28. MVC Architecture
Ext JS 4 comes with a new application architecture that not only organizes
your code but reduces the amount you have to write.
Model
Is a collection of fields and their data (e.g. a User model with username and
password fields). Models know how to persist themselves through the data
package, and can be linked to other models through associations. Models are
normally used with Stores to present data into grids and other components.
View
Is any type of component - grids, trees and panels are all views.
Controllers
Are special places to put all of the code that makes your app work - whether that's
rendering views, instantiating Models, or any other app logic.
License : Creative Commons (Attribution , Share Alike) 3.0 Generic
29. Enough!
Ok, you showed us what you know: great, you did your
homework!
Now we want to see some code!
License : Creative Commons (Attribution , Share Alike) 3.0 Generic
30. Build my WebApp
What do I have to know to build my first web application?
File Structure
/var/www/
index.html
app.js
ext/
app/
controller/
model/
store/
view/
License : Creative Commons (Attribution , Share Alike) 3.0 Generic