Ext.namespace('com.domorewithsage.mock');


com.domorewithsage.mock.CustomerGrid = Ext.extend(Ext.grid.GridPanel, {

    initComponent : function()
    {
        Ext.apply(this, {
            store : new Ext.data.SimpleStore({
                fields: [
                   {name: 'account'},
                   {name: 'acname'},
                   {name: 'balance', type: 'float'},
                   {name: 'credlim', type: 'float'},
                   {name: 'contact'},
                   {name: 'tel'}	
                ]
            }),
            columns : [{
                id        : 'account',
                header    : "A/C",
                width     : 60,
                sortable  : true,
                dataIndex : 'account'
            }, {
                header    : "Name",
                width     : 190,
                sortable  : true,
                dataIndex : 'acname'
            }, {
                header    : "Balance",
                width     : 75,
                sortable  : true,
                renderer  : 'gbMoney',
                align	  : 'right',	
                dataIndex : 'balance'
            }, {
                header    : "Credit Limit",
                width     : 75,
                sortable  : true,
                renderer  : 'gbMoney',
                align	  : 'right',
                dataIndex : 'credlim'
            }, {
                header    : "Contact",
                width     : 100,
                sortable  : true,
                dataIndex : 'contact'
            }, {
                header    : "Telephone",
                width     : 100,
                sortable  : true,
                dataIndex : 'tel'				
			}],
            stripeRows       : true/*,
            autoExpandColumn : 'company'*/
        });

        this._loadData();

        this.on('rowdblclick', function() {
            var m = new com.domorewithsage.mock.CustomerFormWindow({
                modal  : true,
                width  : 860,
                height : 480
            });

            m.show();
        }, this);

        com.domorewithsage.mock.CustomerGrid.superclass.initComponent.call(this);
    },


    _loadData : function()
    {
        this.store.loadData([
            ['3ML001',	'3M Limited',				10234.00,	50000,	'Geoff Smith', '001 234 223 4567'],
            ['ALC001',	'Alcoa Inc',				5556.00,	2500,	'David Bailey', ''],
            ['ALG001',	'Altria Group Inc',			122.23,		10000,	'Richard Gervais', ''],
            ['AMEX01',	'American Express Company',	23334.12,	90000,	'Robert de Niro', ''],
            ['ATT001',	'AT&T Inc.',				1001.00,	2000,	'Geraldine Smith','001 111 202 1001'],
            ['BC0001',	'Boeing Co.',				120202.22,	200000,	'Wallace Barnes',''],
            ['CAT001',	'Caterpillar Inc.',			23000.00,	35000,	'Dr A Smith',	''],
            ['EMC001', 	'Exxon Mobil Corp',			8123.44,	18000,	'Mr D Taylor', ''],
            ['GEC001', 	'General Electric Company',	34.14,		4000,	'B Millar',''],
            ['GMC001',	'General Motors Corporation',30.27,		5000,	'Thomas Arnold', ''],
            ['HPC001', 	'Hewlett-Packard Co.',		36.53,		1500,	'John Taylor',''],
            ['HCI100',	'Honeywell Intl Inc',		38.77,		500,	'A Smith',''],
            ['IC0001', 	'Intel Corporation',		19.88,		2000,	'G Jones',''],
            ['IBM002', 	'International Business Machines',81.41,4000,	'',''],
            ['JJP001', 	'Johnson & Johnson',		864.72,		1000,	'Barry White',''],
            ['JPM001',	'JP Morgan & Chase & Co',	1245.73,	1500,	'A Cunningham',''],
            ['MCD001', 	'McDonald\'s Corporation',	436.76,		500,	'R McDonald',''],
            ['MERC01',	'Merck & Co., Inc.',		40.96,		250,	'R Merck',''],
            ['MSFT01', 	'Microsoft Corporation',	2225.84,	4000,	'S Ballmer',''],
            ['PI0001', 	'Pfizer Inc',				827.96,		2000,	'A Bennett',''],
            ['CCC001',	'The Coca-Cola Company',	145.07,		8000,	'P Bear',''],
            ['THD001', 	'The Home Depot, Inc.',		1234.64,	2000,	'',''],
            ['PNC001',	'The Procter & Gamble Company',4561.91,	9000,	'',''],
            ['UTC001',	'United Technologies Corporation',563.26,1000,	'',''],
            ['VER001', 	'Verizon Communications',	35.57,		500,	'',''],
            ['WMT002',	'Wal-Mart Stores, Inc.',	45.45,		500,	'','']
        ]);
    }

});