Ext.ns('Application', 'Application.Index');
 
Application.Index.MonthGrid = Ext.extend( Ext.grid.GridPanel, {
    frame: true,
    autoHeight: true,    
    title: 'Статистика системы за последние 30 дней',
    autoScroll: true,
    style: 'margin-top: 10px',

    initComponent : function() {
		Ext.apply(this, {
			store: new Ext.data.Store({
				proxy: new Ext.data.HttpProxy({
					url: 'stat/get',      // File to connect to
					method: 'GET'
				}),
				baseParams: {format: "json", type: "full", rows: "month", cols: "sca"}, // this parameter asks for listing
				reader: new Ext.data.JsonReader({   
					root: 'rows'
				},[
				   {name: 'day', type: 'string', mapping: 'day'},
				   {name: 's', type: 'int', mapping: 's'},
				   {name: 'c', type: 'int', mapping: 'c'},
				   {name: 'a', type: 'int', mapping: 'a'}
				])
		    }),
		    columns: [{
		    	header: 'Дата',
		    	dataIndex: 'day' // this is where the mapped name is important!
		    },{
		        header: 'Показы',
		        dataIndex: 's'
		    },{
		        header: 'Клики',
		        dataIndex: 'c'
		    },{
		        header: 'Экшены',
		        dataIndex: 'a'
		    }]
	    });
        // super
		Application.Index.MonthGrid.superclass.initComponent.call(this);
    },
    onRender:function() {
        this.store.load();
 
        Application.Index.MonthGrid.superclass.onRender.apply(this, arguments);
    } // eo function onRender
});

Ext.reg('indexmonthgrid', Application.Index.MonthGrid);