Ext.ns('Application.Index');
 
Application.Index.BannersizeGrid = Ext.extend( Ext.grid.GridPanel, {
    frame: true,
    autoHeight: true,    
    title: 'Статистика системы по форматам',
    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: "bsize", cols: "sys30ctr"}, // this parameter asks for listing
				reader: new Ext.data.JsonReader({   
					root: 'rows',
				},[
				      {name: 'title', type: 'string', mapping: 'title'},
				      {name: 'shows_yesterday', type: 'int', mapping: 'shows_yesterday'},
				      {name: 'shows', type: 'int', mapping: 'shows'},
				      {name: 'ctr', type: 'int', mapping: 'ctr'}
				])
		    }),
		    columns: [{
		        header: 'Формат',
		        dataIndex: 'title' // this is where the mapped name is important!
		      },{
		        header: 'Показов вчера',
		        dataIndex: 'shows_yesterday'
		      },{
		        header: 'Показов за 30 дней',
		        dataIndex: 'shows'
		      },{
		        header: 'CTR за 30 дней',
		        dataIndex: 'ctr'
		    }]
	    });
        // super
		Application.Index.BannersizeGrid.superclass.initComponent.call(this);
    },
    onRender:function() {
        this.store.load();
        Application.Index.BannersizeGrid.superclass.onRender.apply(this, arguments);
    } // eo function onRender
});

Ext.reg('indexbannersizegrid', Application.Index.BannersizeGrid);