-
Notifications
You must be signed in to change notification settings - Fork 0
/
league_keaders_v2.js
219 lines (199 loc) · 6.05 KB
/
league_keaders_v2.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* http://www.sencha.com/license
"id": "4",
"month": "February",
"date": "21st",
"game_time": "05:45:00",
"teams": "Clubbers vs. The Beavers",
"score": "57 - 67",
"team1": "11",
"team2": "12"
*/
Ext.onReady(function() {
var myStore;
var myStore2;
var myStore3;
var grid;
var colModel = new Ext.grid.ColumnModel([
{header: "ID", dataIndex: 'player_id', width:0,sortable:false,align:'left',hidden:true},
{header: "Player", dataIndex: 'player', width:100,sortable:false,renderer : Ext.bhlcommondata.format_underline,align:'left'},
{header: "PPG", dataIndex: 'ppg', width:180,sortable:false,align:'right'}
]);
var ds_model = Ext.data.Record.create([
{ name: 'player_id' },
{ name: 'player'},
{ name: 'ppg', sortType: Ext.data.SortTypes.asFloat }
]);
myStore = new Ext.data.Store({
url: 'league_leaders.php?action=get_player_points',
reader: new Ext.data.JsonReader({
root:'rows',
totalProperty: 'results',
id: 'player_id'
}, ds_model)
});
myStore.load()
grid = new Ext.grid.EditorGridPanel({
viewConfig: {
emptyText: 'No records found'
},
renderTo: 'grid-league-points',
frame:true,
title: 'Points',
width:310,
mode:'local',
layout:'fit',
autoHeight: true,
enableColumnMove: false,
store: myStore,
// columns: [
// {header: "Player", dataIndex: 'player', width:100,sortable:false,align:'left'},
// {header: "Points", dataIndex: 'points', width:180,sortable:false,align:'right'},
//
// ],
cm: colModel,
listeners: {
cellclick: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); // Get the Record
//var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
var data = record.get('player_id');
//console.log('fieldName: '+fieldName+', data: '+data);
window.location.href='player_v2.php?player='+data;
}
},
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
})
});
var ds_model2 = Ext.data.Record.create([
{name:'player_id'},
{ name: 'player'},
{ name: 'rpg', sortType: Ext.data.SortTypes.asFloat }
]);
myStore2 = new Ext.data.Store({
url: 'league_leaders.php?action=get_player_rebounds',
autoLoad: true,
reader: new Ext.data.JsonReader({
root: 'rows1',
idProperty: 'player_id',
totalProperty: 'results1'
}, ds_model2)
});
myStore2.load()
var grid2 = new Ext.grid.EditorGridPanel({
viewConfig: {
emptyText: 'No records found'
},
renderTo: 'grid-league-rebounds',
frame:true,
title: 'Rebounds',
width:320,
mode:'local',
layout:'fit',
autoHeight: true,
enableColumnMove: false,
store: myStore2,
columns: [
{header: "ID", dataIndex: 'player_id', width:0,sortable:false,align:'left',hidden:true},
{header: "Player", dataIndex: 'player', width:120,sortable:false,renderer : Ext.bhlcommondata.format_underline,align:'left'},
{header: "RPG", dataIndex: 'rpg', width:190,sortable:false,align:'right'}
],
listeners: {
cellclick: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex);
var data = record.get('player_id');
window.location.href='player_v2.php?player='+data;
}
},
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
})
});
//var PlayerAssists = Ext.data.Record.create([
// {name: 'player_id',mapping: 'player_id'},
// {name: 'assists',mapping: 'assists',type:'float'}
//
// ]);
var ds_model3 = Ext.data.Record.create([
{name:'player_id'},
{ name: 'player'},
{ name: 'apg', sortType: Ext.data.SortTypes.asFloat }
]);
myStore3 = new Ext.data.Store({
url: 'league_leaders.php?action=get_player_assists',
autoLoad: true,
reader: new Ext.data.JsonReader({
root: 'rows2',
idProperty: 'player_id',
totalProperty: 'results2'
}, ds_model3)
});
myStore3.load()
var grid3 = new Ext.grid.EditorGridPanel({
viewConfig: {
emptyText: 'No records found'
},
renderTo: 'grid-league-assists',
frame:true,
title: 'Assists',
width:300,
mode:'local',
layout:'fit',
autoHeight: true,
enableColumnMove: false,
store: myStore3,
columns: [
{header: "ID", dataIndex: 'player_id', width:0,sortable:false,align:'left',hidden:true},
{header: "Player", dataIndex: 'player', width:100,sortable:false,renderer : Ext.bhlcommondata.format_underline,align:'left'},
{header: "APG", dataIndex: 'apg', width:170,sortable:false,align:'right'}
],
listeners: {
cellclick: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex);
var data = record.get('player_id');
window.location.href='player_v2.php?player='+data;
}
},
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
})
});
// var myStore3 = new Ext.data.Store({
// url: 'league_leaders.php?action=get_player_assists',
// autoLoad: true,
// reader: new Ext.data.JsonReader({
// root: 'rows2',
// idProperty: 'id'
// }, PlayerAssists)
// });
//var pivotGrid3 = new Ext.grid.PivotGrid({
// title : 'Assists',
// /*width : 250,*/
// layout: 'fit',
// autoHeight: true,
// remoteSort: true,
// renderTo : 'grid-league-assists',
// store : myStore3,
// aggregator: 'sum',
// measure : 'assists',
// align: 'right',
//
//
// leftAxis: [
// {
// width: 100,
// dataIndex: 'player_id',
// align:'right'
//
// }
// ],
//
// topAxis: [
//
// ]
//
// });
});