Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Create a basic list, with model+store.

  • Loading branch information...
commit c7cfc4c560a79bfd1d54e2cd1672eb4a0dccc1cf 1 parent 6452738
@nelstrom nelstrom authored
View
6 app.js
@@ -2,11 +2,13 @@ Ext.application({
name: 'Sencha',
controllers: ['Main'],
- views: ['Main'],
+ views: ['PresidentList'],
+ stores: ['Presidents'],
+ models: ['President'],
launch: function() {
Ext.Viewport.add({
- xclass: 'Sencha.view.Main'
+ xtype: 'presidentlist'
});
}
});
View
6 app/model/President.js
@@ -0,0 +1,6 @@
+Ext.define('Sencha.model.President', {
+ extend: 'Ext.data.Model',
+ config: {
+ fields: ['firstName', 'middleInitial', 'lastName']
+ }
+});
View
52 app/store/Presidents.js
@@ -0,0 +1,52 @@
+Ext.define('Sencha.store.Presidents', {
+ extend: 'Ext.data.Store',
+
+ config: {
+ model: 'Sencha.model.President',
+ data: [
+ { firstName: "George", lastName: "Washington" },
+ { firstName: "John", lastName: "Adams" },
+ { firstName: "Thomas", lastName: "Jefferson" },
+ { firstName: "James", lastName: "Madison" },
+ { firstName: "James", lastName: "Monroe" },
+ { firstName: "John", lastName: "Quincy Adams" },
+ { firstName: "Andrew", lastName: "Jackson" },
+ { firstName: "Martin", lastName: "Van Buren" },
+ { firstName: "William", lastName: "Henry Harrison" },
+ { firstName: "John", lastName: "Tyler" },
+ { firstName: "James", middleInitial: "K", lastName: "Polk" },
+ { firstName: "Zachary", lastName: "Taylor" },
+ { firstName: "Millard", lastName: "Fillmore" },
+ { firstName: "Franklin", lastName: "Pierce" },
+ { firstName: "James", lastName: "Buchanan" },
+ { firstName: "Abraham", lastName: "Lincoln" },
+ { firstName: "Andrew", lastName: "Johnson" },
+ { firstName: "Ulysses", middleInitial: "S", lastName: "Grant" },
+ { firstName: "Rutherford", middleInitial: "B", lastName: "Hayes" },
+ { firstName: "James", middleInitial: "A", lastName: "Garfield" },
+ { firstName: "Chester", lastName: "Arthur" },
+ { firstName: "Grover", lastName: "Cleveland" },
+ { firstName: "Benjamin", lastName: "Harrison" },
+ { firstName: "William", lastName: "McKinley" },
+ { firstName: "Theodore", lastName: "Roosevelt" },
+ { firstName: "William", lastName: "Howard Taft" },
+ { firstName: "Woodrow", lastName: "Wilson" },
+ { firstName: "Warren", middleInitial: "G", lastName: "Harding" },
+ { firstName: "Calvin", lastName: "Coolidge" },
+ { firstName: "Herbert", lastName: "Hoover" },
+ { firstName: "Franklin", middleInitial: "D", lastName: "Roosevelt" },
+ { firstName: "Harry", middleInitial: "S", lastName: "Truman" },
+ { firstName: "Dwight", middleInitial: "D", lastName: "Eisenhower" },
+ { firstName: "John", middleInitial: "F", lastName: "Kennedy" },
+ { firstName: "Lyndon", middleInitial: "B", lastName: "Johnson" },
+ { firstName: "Richard", lastName: "Nixon" },
+ { firstName: "Gerald", lastName: "Ford" },
+ { firstName: "Jimmy", lastName: "Carter" },
+ { firstName: "Ronald", lastName: "Reagan" },
+ { firstName: "George", lastName: "Bush" },
+ { firstName: "Bill", lastName: "Clinton" },
+ { firstName: "George", middleInitial: "W", lastName: "Bush" },
+ { firstName: "Barack", lastName: "Obama" }
+ ]
+ }
+});
View
10 app/view/PresidentList.js
@@ -0,0 +1,10 @@
+Ext.define('Sencha.view.PresidentList', {
+ extend: 'Ext.List',
+ xtype: 'presidentlist',
+ requires: ['Sencha.store.Presidents'],
+
+ config: {
+ itemTpl: '{firstName} {lastName}',
+ store: 'Presidents',
+ }
+});
Please sign in to comment.
Something went wrong with that request. Please try again.