1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| Ext.define('KitchenSink.model.Company', {
| extend: 'Ext.data.Model',
| fields: [
| {name: 'company'},
| {name: 'price', type: 'float'},
| {name: 'change', type: 'float'},
| {name: 'pctChange', type: 'float'},
| {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'},
| // Rating dependent upon performance 0 = best, 2 = worst
| {
| name: 'rating',
| type: 'int',
| convert: function(value, record) {
| var pct = record.get('pctChange');
| if (pct < 0)
| return 2;
| if (pct < 1)
| return 1;
| return 0;
| }
| }
| ]
| });
|
|