Permalink
Browse files

Step 3 - Basic grid bound to a data store

  • Loading branch information...
1 parent a2f9715 commit 7f250d18536ae27f9b074be88b9f09ffcd3ed653 Aaron Conran committed Aug 12, 2012
View
24 CarListings.xds
@@ -28,15 +28,35 @@
"metadata/resource/Library"
],
"className": "Library"
+ },
+ "0315c038-557a-4e0a-8263-df261c02f018": {
+ "paths": [
+ "metadata/store/CarDataStore",
+ "app/store/override/CarDataStore.js",
+ "app/store/CarDataStore.js"
+ ],
+ "className": "CarDataStore"
+ },
+ "44284846-393f-4336-9e37-fe0ed78e1e2a": {
+ "paths": [
+ "metadata/model/CarData",
+ "app/model/override/CarData.js",
+ "app/model/CarData.js"
+ ],
+ "className": "CarData"
}
},
"viewOrderMap": {
"view": [
"fa6a13d2-be29-4bce-9bf8-7087e3a9c6ba"
],
- "store": [],
+ "store": [
+ "0315c038-557a-4e0a-8263-df261c02f018"
+ ],
"controller": [],
- "model": [],
+ "model": [
+ "44284846-393f-4336-9e37-fe0ed78e1e2a"
+ ],
"resource": [
"67363d08-999e-4648-b11d-5d9fe657da91"
],
View
6 app.js
@@ -18,6 +18,12 @@ Ext.Loader.setConfig({
});
Ext.application({
+ models: [
+ 'CarData'
+ ],
+ stores: [
+ 'CarDataStore'
+ ],
views: [
'CarListings'
],
View
36 app/model/CarData.js
@@ -0,0 +1,36 @@
+/*
+ * File: app/model/CarData.js
+ *
+ * This file was generated by Sencha Architect version 2.0.0.
+ * http://www.sencha.com/products/architect/
+ *
+ * This file requires use of the Ext JS 4.1.x library, under independent license.
+ * License of Sencha Architect does not include license for Ext JS 4.1.x. For more
+ * details see http://www.sencha.com/license or contact license@sencha.com.
+ *
+ * This file will be auto-generated each and everytime you save your project.
+ *
+ * Do NOT hand edit this file.
+ */
+
+Ext.define('MyApp.model.CarData', {
+ extend: 'Ext.data.Model',
+
+ fields: [
+ {
+ name: 'manufacturer'
+ },
+ {
+ name: 'model'
+ },
+ {
+ name: 'price'
+ },
+ {
+ name: 'wiki'
+ },
+ {
+ name: 'quality'
+ }
+ ]
+});
View
40 app/store/CarDataStore.js
@@ -0,0 +1,40 @@
+/*
+ * File: app/store/CarDataStore.js
+ *
+ * This file was generated by Sencha Architect version 2.0.0.
+ * http://www.sencha.com/products/architect/
+ *
+ * This file requires use of the Ext JS 4.1.x library, under independent license.
+ * License of Sencha Architect does not include license for Ext JS 4.1.x. For more
+ * details see http://www.sencha.com/license or contact license@sencha.com.
+ *
+ * This file will be auto-generated each and everytime you save your project.
+ *
+ * Do NOT hand edit this file.
+ */
+
+Ext.define('MyApp.store.CarDataStore', {
+ extend: 'Ext.data.Store',
+
+ requires: [
+ 'MyApp.model.CarData'
+ ],
+
+ constructor: function(cfg) {
+ var me = this;
+ cfg = cfg || {};
+ me.callParent([Ext.apply({
+ autoLoad: true,
+ storeId: 'MyJsonStore',
+ model: 'MyApp.model.CarData',
+ proxy: {
+ type: 'ajax',
+ url: 'data/cars.json',
+ reader: {
+ type: 'json',
+ root: 'data'
+ }
+ }
+ }, cfg)]);
+ }
+});
View
36 app/view/CarListings.js
@@ -33,31 +33,37 @@ Ext.define('MyApp.view.CarListings', {
{
xtype: 'gridpanel',
flex: 1,
+ store: 'CarDataStore',
+ viewConfig: {
+
+ },
columns: [
{
xtype: 'gridcolumn',
- dataIndex: 'string',
- text: 'String'
+ dataIndex: 'manufacturer',
+ text: 'Manufacturer'
+ },
+ {
+ xtype: 'gridcolumn',
+ dataIndex: 'model',
+ text: 'Model'
},
{
- xtype: 'numbercolumn',
- dataIndex: 'number',
- text: 'Number'
+ xtype: 'gridcolumn',
+ dataIndex: 'price',
+ text: 'Price'
},
{
- xtype: 'datecolumn',
- dataIndex: 'date',
- text: 'Date'
+ xtype: 'gridcolumn',
+ dataIndex: 'wiki',
+ text: 'Wiki'
},
{
- xtype: 'booleancolumn',
- dataIndex: 'bool',
- text: 'Boolean'
+ xtype: 'gridcolumn',
+ dataIndex: 'quality',
+ text: 'Quality'
}
- ],
- viewConfig: {
-
- }
+ ]
}
]
});
View
BIN data/2004_Porsche_911_Carrera_type_997.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN data/250px-2007_Audi_TT_Coupe.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN data/250px-Audi_S5.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN data/250px-BMW_M3_E92.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN data/250px-Nissan_GT-R.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
130 data/cars.json
@@ -0,0 +1,130 @@
+{
+ "data" : [{
+ "img" : "2004_Porsche_911_Carrera_type_997.jpg",
+ "manufacturer" : "Porsche",
+ "model" : "911",
+ "price" : 135000,
+ "quality" : [{
+ "name" : "overall",
+ "rating" : 1
+ },{
+ "name" : "mechanical",
+ "rating" : 4
+ },{
+ "name" : "powertrain",
+ "rating" : 2
+ },{
+ "name" : "body",
+ "rating" : 4
+ },{
+ "name" : "interior",
+ "rating" : 3
+ },{
+ "name" : "accessories",
+ "rating" : 2
+ }],
+ "wiki" : "http://en.wikipedia.org/wiki/Porsche_997"
+ },{
+ "img" : "250px-Nissan_GT-R.jpg",
+ "manufacturer" : "Nissan",
+ "model" : "GT-R",
+ "price" : 80000,
+ "quality" : [{
+ "name" : "overall",
+ "rating" : 2
+ },
+ { "name" : "mechanical",
+ "rating" : 3
+ },
+ { "name" : "powertrain",
+ "rating" : 5
+ },
+ { "name" : "body",
+ "rating" : 4
+ },
+ { "name" : "interior",
+ "rating" : 2
+ },
+ { "name" : "accessories",
+ "rating" : 2
+ }
+ ],
+ "wiki" : "http://en.wikipedia.org/wiki/Nissan_Gt-r"
+ },{
+ "img" : "250px-BMW_M3_E92.jpg",
+ "manufacturer" : "BMW",
+ "model" : "M3",
+ "price" : 60500,
+ "quality" : [ { "name" : "overall",
+ "rating" : 3
+ },
+ { "name" : "mechanical",
+ "rating" : 5
+ },
+ { "name" : "powertrain",
+ "rating" : 3
+ },
+ { "name" : "body",
+ "rating" : 4
+ },
+ { "name" : "interior",
+ "rating" : 5
+ },
+ { "name" : "accessories",
+ "rating" : 3
+ }
+ ],
+ "wiki" : "http://en.wikipedia.org/wiki/Bmw_m3"
+ },{
+ "img" : "250px-Audi_S5.jpg",
+ "manufacturer" : "Audi",
+ "model" : "S5",
+ "price" : 53000,
+ "quality" : [ { "name" : "overall",
+ "rating" : 4
+ },
+ { "name" : "mechanical",
+ "rating" : 1
+ },
+ { "name" : "powertrain",
+ "rating" : 1
+ },
+ { "name" : "body",
+ "rating" : 4
+ },
+ { "name" : "interior",
+ "rating" : 1
+ },
+ { "name" : "accessories",
+ "rating" : 5
+ }
+ ],
+ "wiki" : "http://en.wikipedia.org/wiki/Audi_S5#Audi_S5"
+ },{
+ "img" : "250px-2007_Audi_TT_Coupe.jpg",
+ "manufacturer" : "Audi",
+ "model" : "TT",
+ "price" : 40000,
+ "quality" : [{
+ "name" : "overall",
+ "rating" : 5
+ },
+ { "name" : "mechanical",
+ "rating" : 2
+ },
+ { "name" : "powertrain",
+ "rating" : 2
+ },
+ { "name" : "body",
+ "rating" : 3
+ },
+ { "name" : "interior",
+ "rating" : 4
+ },
+ { "name" : "accessories",
+ "rating" : 1
+ }
+ ],
+ "wiki" : "http://en.wikipedia.org/wiki/Audi_TT"
+ }]
+}
View
6 metadata/Application
@@ -6,6 +6,12 @@
},
"codeClass": null,
"userConfig": {
+ "models": [
+ "CarData"
+ ],
+ "stores": [
+ "CarDataStore"
+ ],
"views": [
"CarListings"
],
View
80 metadata/model/CarData
@@ -0,0 +1,80 @@
+{
+ "type": "datamodel",
+ "reference": {
+ "name": "items",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "CarData"
+ },
+ "id": "ExtBox1-ext-gen4108",
+ "designerId": "44284846-393f-4336-9e37-fe0ed78e1e2a",
+ "cn": [
+ {
+ "type": "datafield",
+ "reference": {
+ "name": "fields",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyField",
+ "name": "manufacturer"
+ },
+ "designerId": "1f2a373a-5542-45c1-a073-a19e2f24e573"
+ },
+ {
+ "type": "datafield",
+ "reference": {
+ "name": "fields",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyField1",
+ "name": "model"
+ },
+ "designerId": "9457f1d9-cb15-48a2-929e-aba43749eb39"
+ },
+ {
+ "type": "datafield",
+ "reference": {
+ "name": "fields",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyField2",
+ "name": "price"
+ },
+ "designerId": "0bdbd53c-a3a3-42e5-af2c-6b664d2f1fa8"
+ },
+ {
+ "type": "datafield",
+ "reference": {
+ "name": "fields",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyField3",
+ "name": "wiki"
+ },
+ "designerId": "5772beaa-658d-478c-a8f4-a485e9a4f30e"
+ },
+ {
+ "type": "datafield",
+ "reference": {
+ "name": "fields",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyField4",
+ "name": "quality"
+ },
+ "designerId": "0846e5f8-7b72-434a-a64c-cb3f88af72d1"
+ }
+ ]
+}
View
46 metadata/store/CarDataStore
@@ -0,0 +1,46 @@
+{
+ "type": "jsonstore",
+ "reference": {
+ "name": "items",
+ "type": "array"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "CarDataStore",
+ "autoLoad": true,
+ "storeId": "MyJsonStore",
+ "model": "CarData"
+ },
+ "id": "ExtBox1-ext-gen5045",
+ "designerId": "0315c038-557a-4e0a-8263-df261c02f018",
+ "cn": [
+ {
+ "type": "ajaxproxy",
+ "reference": {
+ "name": "proxy",
+ "type": "object"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyAjaxProxy",
+ "url": "data/cars.json"
+ },
+ "designerId": "b14e40ae-0e6c-4385-99f1-6f74052c2325",
+ "cn": [
+ {
+ "type": "jsonreader",
+ "reference": {
+ "name": "reader",
+ "type": "object"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyJsonReader",
+ "root": "data"
+ },
+ "designerId": "84c9270c-599b-4349-aab1-978aa0607fb3"
+ }
+ ]
+ }
+ ]
+}
View
65 metadata/view/CarListings
@@ -28,77 +28,92 @@
"userConfig": {
"layout|flex": 1,
"designer|userClassName": "MyGridPanel",
- "title": null
+ "title": null,
+ "store": "CarDataStore"
},
"designerId": "a5a407e7-18fa-4914-918f-2c5b6789392d",
"cn": [
{
+ "type": "gridview",
+ "reference": {
+ "name": "viewConfig",
+ "type": "object"
+ },
+ "codeClass": null,
+ "userConfig": {
+ "designer|userClassName": "MyGridView"
+ },
+ "designerId": "78c707bc-3756-4dfe-bfc3-e79324bf3b1b"
+ },
+ {
"type": "gridcolumn",
"reference": {
"name": "columns",
"type": "array"
},
"codeClass": null,
"userConfig": {
- "designer|userClassName": "MyColumn",
- "dataIndex": "string",
- "text": "String"
+ "designer|userClassName": "MyColumn1",
+ "dataIndex": "manufacturer",
+ "text": "Manufacturer"
},
- "designerId": "119acfec-3bac-4ff2-a475-c9accd38bbcf"
+ "designerId": "aa12be43-ba64-4553-9672-d4ce69212624"
},
{
- "type": "numbercolumn",
+ "type": "gridcolumn",
"reference": {
"name": "columns",
"type": "array"
},
"codeClass": null,
"userConfig": {
- "designer|userClassName": "MyNumberColumn",
- "dataIndex": "number",
- "text": "Number"
+ "designer|userClassName": "MyColumn2",
+ "dataIndex": "model",
+ "text": "Model"
},
- "designerId": "ed8d026f-62e3-43a5-952b-bf47fdbf1b51"
+ "designerId": "048a726e-a37d-425b-b474-5cf54b65c09f"
},
{
- "type": "datecolumn",
+ "type": "gridcolumn",
"reference": {
"name": "columns",
"type": "array"
},
"codeClass": null,
"userConfig": {
- "designer|userClassName": "MyDateColumn",
- "dataIndex": "date",
- "text": "Date"
+ "designer|userClassName": "MyColumn3",
+ "dataIndex": "price",
+ "text": "Price"
},
- "designerId": "e4c92ad7-5d45-4202-9eab-c80a49321f83"
+ "designerId": "d4365dc6-c235-426c-8225-3e5754579906"
},
{
- "type": "booleancolumn",
+ "type": "gridcolumn",
"reference": {
"name": "columns",
"type": "array"
},
"codeClass": null,
"userConfig": {
- "designer|userClassName": "MyBooleanColumn",
- "dataIndex": "bool",
- "text": "Boolean"
+ "designer|userClassName": "MyColumn4",
+ "dataIndex": "wiki",
+ "text": "Wiki"
},
- "designerId": "597cc4ee-1148-44ee-9259-212c7468d3ac"
+ "designerId": "07eaf801-329a-4c01-a1ea-1ad051569935"
},
{
- "type": "gridview",
+ "type": "gridcolumn",
"reference": {
- "name": "viewConfig",
- "type": "object"
+ "name": "columns",
+ "type": "array"
},
"codeClass": null,
"userConfig": {
- "designer|userClassName": "MyGridView"
+ "designer|userClassName": "MyColumn5",
+ "dataIndex": "quality",
+ "text": "Quality"
},
- "designerId": "78c707bc-3756-4dfe-bfc3-e79324bf3b1b"
+ "designerId": "3c22bf8d-b26a-49ee-8339-948b2b70a48e"
}
]
}

0 comments on commit 7f250d1

Please sign in to comment.