Upgrade to ExtJS 3.3.1 - Released 11/30/2010
[extjs.git] / examples / pivotgrid / simple.js
1 /*!
2  * Ext JS Library 3.3.1
3  * Copyright(c) 2006-2010 Sencha Inc.
4  * licensing@sencha.com
5  * http://www.sencha.com/license
6  */
7 Ext.onReady(function() {
8     var SaleRecord = Ext.data.Record.create([
9         {name: 'person',   type: 'string'},
10         {name: 'product',  type: 'string'},
11         {name: 'city',     type: 'string'},
12         {name: 'state',    type: 'string'},
13         {name: 'month',    type: 'int'},
14         {name: 'quarter',  type: 'int'},
15         {name: 'year',     type: 'int'},
16         {name: 'quantity', type: 'int'},
17         {name: 'value',    type: 'int'}
18     ]);
19     
20     var myStore = new Ext.data.Store({
21         url: 'simple.json',
22         autoLoad: true,
23         reader: new Ext.data.JsonReader({
24             root: 'rows',
25             idProperty: 'id'
26         }, SaleRecord)
27     });
28     
29     var pivotGrid = new Ext.grid.PivotGrid({
30         title     : 'PivotGrid example',
31         width     : 800,
32         height    : 259,
33         renderTo  : 'docbody',
34         store     : myStore,
35         aggregator: 'sum',
36         measure   : 'value',
37         
38         viewConfig: {
39             title: 'Sales Performance'
40         },
41         
42         leftAxis: [
43             {
44                 width: 80,
45                 dataIndex: 'person'
46             },
47             {
48                 width: 90,
49                 dataIndex: 'product'
50             }
51         ],
52         
53         topAxis: [
54             {
55                 dataIndex: 'year'
56             },
57             {
58                 dataIndex: 'city'
59             }
60         ]
61     });
62 });