grid-configs.js
上传用户:dawnssy
上传日期:2022-08-06
资源大小:9345k
文件大小:9k
源码类别:

JavaScript

开发平台:

JavaScript

  1. /*!
  2.  * Ext JS Library 3.1.0
  3.  * Copyright(c) 2006-2009 Ext JS, LLC
  4.  * licensing@extjs.com
  5.  * http://www.extjs.com/license
  6.  */
  7. /*!
  8.  * Ext JS Library 3.1.0
  9.  * Copyright(c) 2006-2009 Ext JS, LLC
  10.  * licensing@extjs.com
  11.  * http://www.extjs.com/license
  12.  */
  13. /*!
  14.  * Ext JS Library 3.1.0
  15.  * Copyright(c) 2006-2009 Ext JS, LLC
  16.  * licensing@extjs.com
  17.  * http://www.extjs.com/license
  18.  */
  19. /*!
  20.  * Ext JS Library 3.1.0
  21.  * Copyright(c) 2006-2009 Ext JS, LLC
  22.  * licensing@extjs.com
  23.  * http://www.extjs.com/license
  24.  */
  25. /*!
  26.  * Ext JS Library 3.1.0
  27.  * Copyright(c) 2006-2009 Ext JS, LLC
  28.  * licensing@extjs.com
  29.  * http://www.extjs.com/license
  30.  */
  31. /*!
  32.  * Ext JS Library 3.1.0
  33.  * Copyright(c) 2006-2009 Ext JS, LLC
  34.  * licensing@extjs.com
  35.  * http://www.extjs.com/license
  36.  */
  37. /*!
  38.  * Ext JS Library 3.1.0
  39.  * Copyright(c) 2006-2009 Ext JS, LLC
  40.  * licensing@extjs.com
  41.  * http://www.extjs.com/license
  42.  */
  43. /*!
  44.  * Ext JS Library 3.1.0
  45.  * Copyright(c) 2006-2009 Ext JS, LLC
  46.  * licensing@extjs.com
  47.  * http://www.extjs.com/license
  48.  */
  49. /*!
  50.  * Ext JS Library 3.1.0
  51.  * Copyright(c) 2006-2009 Ext JS, LLC
  52.  * licensing@extjs.com
  53.  * http://www.extjs.com/license
  54.  */
  55. /*!
  56.  * Ext JS Library 3.1.0
  57.  * Copyright(c) 2006-2009 Ext JS, LLC
  58.  * licensing@extjs.com
  59.  * http://www.extjs.com/license
  60.  */
  61. /*!
  62.  * Ext JS Library 3.1.0
  63.  * Copyright(c) 2006-2009 Ext JS, LLC
  64.  * licensing@extjs.com
  65.  * http://www.extjs.com/license
  66.  */
  67. /*!
  68.  * Ext JS Library 3.1.0
  69.  * Copyright(c) 2006-2009 Ext JS, LLC
  70.  * licensing@extjs.com
  71.  * http://www.extjs.com/license
  72.  */
  73. /*!
  74.  * Ext JS Library 3.1.0
  75.  * Copyright(c) 2006-2009 Ext JS, LLC
  76.  * licensing@extjs.com
  77.  * http://www.extjs.com/license
  78.  */
  79. /*!
  80.  * Ext JS Library 3.1.0
  81.  * Copyright(c) 2006-2009 Ext JS, LLC
  82.  * licensing@extjs.com
  83.  * http://www.extjs.com/license
  84.  */
  85. /*!
  86.  * Ext JS Library 3.1.0
  87.  * Copyright(c) 2006-2009 Ext JS, LLC
  88.  * licensing@extjs.com
  89.  * http://www.extjs.com/license
  90.  */
  91. /*!
  92.  * Ext JS Library 3.1.0
  93.  * Copyright(c) 2006-2009 Ext JS, LLC
  94.  * licensing@extjs.com
  95.  * http://www.extjs.com/license
  96.  */
  97. /*!
  98.  * Ext JS Library 3.1.0
  99.  * Copyright(c) 2006-2009 Ext JS, LLC
  100.  * licensing@extjs.com
  101.  * http://www.extjs.com/license
  102.  */
  103. /*!
  104.  * Ext JS Library 3.1.0
  105.  * Copyright(c) 2006-2009 Ext JS, LLC
  106.  * licensing@extjs.com
  107.  * http://www.extjs.com/license
  108.  */
  109. /*!
  110.  * Ext JS Library 3.1.0
  111.  * Copyright(c) 2006-2009 Ext JS, LLC
  112.  * licensing@extjs.com
  113.  * http://www.extjs.com/license
  114.  */
  115. /*!
  116.  * Ext JS Library 3.1.0
  117.  * Copyright(c) 2006-2009 Ext JS, LLC
  118.  * licensing@extjs.com
  119.  * http://www.extjs.com/license
  120.  */
  121. /*!
  122.  * Ext JS Library 3.1.0
  123.  * Copyright(c) 2006-2009 Ext JS, LLC
  124.  * licensing@extjs.com
  125.  * http://www.extjs.com/license
  126.  */
  127. /*!
  128.  * Ext JS Library 3.1.0
  129.  * Copyright(c) 2006-2009 Ext JS, LLC
  130.  * licensing@extjs.com
  131.  * http://www.extjs.com/license
  132.  */
  133. /*!
  134.  * Ext JS Library 3.1.0
  135.  * Copyright(c) 2006-2009 Ext JS, LLC
  136.  * licensing@extjs.com
  137.  * http://www.extjs.com/license
  138.  */
  139. /*!
  140.  * Ext JS Library 3.1.0
  141.  * Copyright(c) 2006-2009 Ext JS, LLC
  142.  * licensing@extjs.com
  143.  * http://www.extjs.com/license
  144.  */
  145. /*!
  146.  * Ext JS Library 3.1.0
  147.  * Copyright(c) 2006-2009 Ext JS, LLC
  148.  * licensing@extjs.com
  149.  * http://www.extjs.com/license
  150.  */
  151. /*!
  152.  * Ext JS Library 3.1.0
  153.  * Copyright(c) 2006-2009 Ext JS, LLC
  154.  * licensing@extjs.com
  155.  * http://www.extjs.com/license
  156.  */
  157. /*!
  158.  * Ext JS Library 3.1.0
  159.  * Copyright(c) 2006-2009 Ext JS, LLC
  160.  * licensing@extjs.com
  161.  * http://www.extjs.com/license
  162.  */
  163. /*!
  164.  * Ext JS Library 3.1.0
  165.  * Copyright(c) 2006-2009 Ext JS, LLC
  166.  * licensing@extjs.com
  167.  * http://www.extjs.com/license
  168.  */
  169. /*!
  170.  * Ext JS Library 3.1.0
  171.  * Copyright(c) 2006-2009 Ext JS, LLC
  172.  * licensing@extjs.com
  173.  * http://www.extjs.com/license
  174.  */
  175. /*!
  176.  * Ext JS Library 3.1.0
  177.  * Copyright(c) 2006-2009 Ext JS, LLC
  178.  * licensing@extjs.com
  179.  * http://www.extjs.com/license
  180.  */
  181. /*!
  182.  * Ext JS Library 3.1.0
  183.  * Copyright(c) 2006-2009 Ext JS, LLC
  184.  * licensing@extjs.com
  185.  * http://www.extjs.com/license
  186.  */
  187. /*!
  188.  * Ext JS Library 3.1.0
  189.  * Copyright(c) 2006-2009 Ext JS, LLC
  190.  * licensing@extjs.com
  191.  * http://www.extjs.com/license
  192.  */
  193. /*!
  194.  * Ext JS Library 3.1.0
  195.  * Copyright(c) 2006-2009 Ext JS, LLC
  196.  * licensing@extjs.com
  197.  * http://www.extjs.com/license
  198.  */
  199. /*!
  200.  * Ext JS Library 3.1.0
  201.  * Copyright(c) 2006-2009 Ext JS, LLC
  202.  * licensing@extjs.com
  203.  * http://www.extjs.com/license
  204.  */
  205. /*!
  206.  * Ext JS Library 3.1.0
  207.  * Copyright(c) 2006-2009 Ext JS, LLC
  208.  * licensing@extjs.com
  209.  * http://www.extjs.com/license
  210.  */
  211. /*!
  212.  * Ext JS Library 3.1.0
  213.  * Copyright(c) 2006-2009 Ext JS, LLC
  214.  * licensing@extjs.com
  215.  * http://www.extjs.com/license
  216.  */
  217. /*!
  218.  * Ext JS Library 3.1.0
  219.  * Copyright(c) 2006-2009 Ext JS, LLC
  220.  * licensing@extjs.com
  221.  * http://www.extjs.com/license
  222.  */
  223. /*!
  224.  * Ext JS Library 3.1.0
  225.  * Copyright(c) 2006-2009 Ext JS, LLC
  226.  * licensing@extjs.com
  227.  * http://www.extjs.com/license
  228.  */
  229. /*!
  230.  * Ext JS Library 3.1.0
  231.  * Copyright(c) 2006-2009 Ext JS, LLC
  232.  * licensing@extjs.com
  233.  * http://www.extjs.com/license
  234.  */
  235. /*!
  236.  * Ext JS Library 3.1.0
  237.  * Copyright(c) 2006-2009 Ext JS, LLC
  238.  * licensing@extjs.com
  239.  * http://www.extjs.com/license
  240.  */
  241. /*!
  242.  * Ext JS Library 3.1.0
  243.  * Copyright(c) 2006-2009 Ext JS, LLC
  244.  * licensing@extjs.com
  245.  * http://www.extjs.com/license
  246.  */
  247. /*!
  248.  * Ext JS Library 3.1.0
  249.  * Copyright(c) 2006-2009 Ext JS, LLC
  250.  * licensing@extjs.com
  251.  * http://www.extjs.com/license
  252.  */
  253. /*!
  254.  * Ext JS Library 3.1.0
  255.  * Copyright(c) 2006-2009 Ext JS, LLC
  256.  * licensing@extjs.com
  257.  * http://www.extjs.com/license
  258.  */
  259. // Data for the grid config.
  260. var myData = [
  261.     ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
  262.     ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
  263.     ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
  264.     ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
  265.     ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
  266.     ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
  267.     ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
  268.     ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
  269.     ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
  270.     ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
  271.     ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
  272.     ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
  273.     ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
  274.     ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
  275.     ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
  276.     ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
  277.     ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],
  278.     ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
  279.     ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],
  280.     ['McDonald's Corporation',36.76,0.86,2.40,'9/1 12:00am'],
  281.     ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
  282.     ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
  283.     ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],
  284.     ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
  285.     ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],
  286.     ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
  287.     ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],
  288.     ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],            
  289.     ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
  290. ];
  291. /**
  292.  * Custom function used for column renderer
  293.  * @param {Object} val
  294.  */
  295. function change(val){
  296.     if(val > 0){
  297.         return '<span style="color:green;">' + val + '</span>';
  298.     }else if(val < 0){
  299.         return '<span style="color:red;">' + val + '</span>';
  300.     }
  301.     return val;
  302. }
  303. /**
  304.  * Custom function used for column renderer
  305.  * @param {Object} val
  306.  */
  307. function pctChange(val){
  308.     if(val > 0){
  309.         return '<span style="color:green;">' + val + '%</span>';
  310.     }else if(val < 0){
  311.         return '<span style="color:red;">' + val + '%</span>';
  312.     }
  313.     return val;
  314. }
  315. // create the data store
  316. var store = new Ext.data.ArrayStore({
  317.     fields: [
  318.        {name: 'company'},
  319.        {name: 'price', type: 'float'},
  320.        {name: 'change', type: 'float'},
  321.        {name: 'pctChange', type: 'float'},
  322.        {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
  323.     ]
  324. });
  325. // manually load local data
  326. store.loadData(myData);
  327. // There is only 1 grid config.
  328. var gridConfigs = [{
  329.    //
  330.    // -- grid config 1
  331.    //
  332.    xtype: 'grid',
  333.    baseCls: 'x-bubble',
  334.    frame: true,
  335.    border: false,
  336.    height: 440,
  337.    width: 680,
  338.    monitorWindowResize: false,
  339.    store: store,
  340.    columns: [
  341.       {id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'},
  342.       {header: 'Price', width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
  343.       {header: 'Change', width: 75, sortable: true, renderer: change, dataIndex: 'change'},
  344.       {header: '% Change', width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
  345.       {header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
  346.    ],
  347.    stripeRows: true,
  348.    autoExpandColumn: 'company'
  349. },{
  350.    //
  351.    // -- grid config 2
  352.    //
  353. }];