Ext.BLANK_IMAGE_URL = '/lib/resources/images/default/s.gif'; /* * Ext JS Library 2.0 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.onReady(function(){ // second tabs built from JS var Iran = [ ['ATS (Amphetamine)',0,0,38,0,1462,0], ['Cocaine',0,11,9,9,15,21], ['Crack',0,0,430,3305,0,0], ['Ecstasy',0,0,0,0,11,0], ['Hashish',67277,59488,89718,75092,69222,0], ['Heroin',5553,10663,13644,19824,24926,27141], ['Morphine',6937,10606,9681,8977,16139,8098], ['Opium',225095,311306,427147,562059,0,393210], ['Other',6319,11928,13200,0,0,0] ]; function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ' ' + '$2'); } return x1 + x2; } function ifZero(val){ var d=val.toFixed(2); if(val > 0){ return addCommas(d); }else if(val <= 0){ return 'n/a'; } return val; } var myReader = new Ext.data.ArrayReader({},[ {name: 'Drug_Type'}, {name: '2005', type: 'float'}, {name: '2006', type: 'float'}, {name: '2007', type: 'float'}, {name: '2008', type: 'float'}, {name: '2009', type: 'float'}, {name: '2010', type: 'float'} ]); var tabs2 = new Ext.TabPanel({ renderTo: "myDiv", activeTab: 0, width:600, height:400, plain:true, defaults:{autoScroll: false}, items:[{ xtype: 'grid', title: 'Iran', store: new Ext.data.Store({data: Iran, reader: myReader}), columns: [ {header: 'Drug Type', width: 125, hideable: false, sortable: true, dataIndex: 'Drug_Type'}, {header: '