]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | Ext.define('KitchenSink.model.pivot.Sale', function() {\r |
2 | var regions = {\r | |
3 | "Belgium": 'Europe',\r | |
4 | "Netherlands": 'Europe',\r | |
5 | "United Kingdom": 'Europe',\r | |
6 | "Canada": 'North America',\r | |
7 | "United States": 'North America',\r | |
8 | "Australia": 'Australia'\r | |
9 | };\r | |
10 | \r | |
11 | return {\r | |
12 | extend: 'KitchenSink.model.Base',\r | |
13 | \r | |
14 | fields: [\r | |
15 | {name: 'id', type: 'int'},\r | |
16 | {name: 'company', type: 'string'},\r | |
17 | {name: 'country', type: 'string'},\r | |
18 | {name: 'person', type: 'string'},\r | |
19 | {name: 'date', type: 'date', dateFormat: 'c'},\r | |
20 | {name: 'value', type: 'float'},\r | |
21 | {name: 'quantity', type: 'float'},\r | |
22 | {\r | |
23 | name: 'year',\r | |
24 | convert: function(v, record){\r | |
25 | return Ext.Date.format(record.get('date'), "Y");\r | |
26 | }\r | |
27 | },{\r | |
28 | name: 'month',\r | |
29 | convert: function(v, record){\r | |
30 | return parseInt(Ext.Date.format(record.get('date'), "m"), 10) - 1;\r | |
31 | }\r | |
32 | },{\r | |
33 | name: 'continent',\r | |
34 | convert: function(v, record){\r | |
35 | return regions[record.get('country')];\r | |
36 | }\r | |
37 | }\r | |
38 | ]\r | |
39 | };\r | |
40 | });\r |