forked from olegtaranenko/bryntum-quiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview-proto.js
67 lines (58 loc) · 1.59 KB
/
view-proto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Created with JetBrains WebStorm.
* User: user1
* Date: 27.12.12
* Time: 13:10
* To change this template use File | Settings | File Templates.
*/
var myData = [
['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
];
var store = Ext.create('Ext.data.ArrayStore', {
// store configs
autoDestroy: true,
storeId: 'myStore',
// reader configs
idIndex: 0,
data: myData,
fields: [
'company',
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]
});
Ext.define('MyGrid', {
extend : 'Ext.grid.Panel',
store: 'myStore',
alias: 'widget.mygrid',
columns : [
{
text : 'Company',
dataIndex : 'company',
renderer : function(value, meta, record, row, column, store, view) {
meta.style = "background-color:" + view.getCellColor();
return value;
}
}
],
colors : {
cell : '#00AAAA'
},
viewConfig: {
setCellColor : function(color) {
var form = this.ownerCt;
form.cellColors.cell = color;
this.refresh();
},
getCellColor : function() {
var form = this.ownerCt;
return form.cellColors.cell;
}
}
});