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 Afghanistan = [ ['Cocaine',7,0,0,0,0,0], ['Hashish',49387,36896.08,60544.845,305493,23041.1,0], ['Heroin',7771,3600.27,5180.3117,2249.87,2172.32,0], ['Morphine',201,192.81,9338.987,63,28692,0], ['Opium',86592,29424.58,54159.349,26786.8,40832.8,0], ['Other',25695,23962,0,0,0,0], ['Precursors',43617,57357.08,140616.89,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: 'Afghanistan', store: new Ext.data.Store({data: Afghanistan, reader: myReader}), columns: [ {header: 'Drug Type', width: 125, hideable: false, sortable: true, dataIndex: 'Drug_Type'}, {header: '