Number4.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-grid-column-Number'>/**
  19. </span> * A Column definition class which renders a numeric data field according to a {@link #format} string.
  20. *
  21. * @example
  22. * Ext.create('Ext.data.Store', {
  23. * storeId:'sampleStore',
  24. * fields:[
  25. * { name: 'symbol', type: 'string' },
  26. * { name: 'price', type: 'number' },
  27. * { name: 'change', type: 'number' },
  28. * { name: 'volume', type: 'number' }
  29. * ],
  30. * data:[
  31. * { symbol: &quot;msft&quot;, price: 25.76, change: 2.43, volume: 61606325 },
  32. * { symbol: &quot;goog&quot;, price: 525.73, change: 0.81, volume: 3053782 },
  33. * { symbol: &quot;apple&quot;, price: 342.41, change: 1.35, volume: 24484858 },
  34. * { symbol: &quot;sencha&quot;, price: 142.08, change: 8.85, volume: 5556351 }
  35. * ]
  36. * });
  37. *
  38. * Ext.create('Ext.grid.Panel', {
  39. * title: 'Number Column Demo',
  40. * store: Ext.data.StoreManager.lookup('sampleStore'),
  41. * columns: [
  42. * { text: 'Symbol', dataIndex: 'symbol', flex: 1 },
  43. * { text: 'Current Price', dataIndex: 'price', renderer: Ext.util.Format.usMoney },
  44. * { text: 'Change', dataIndex: 'change', xtype: 'numbercolumn', format:'0.00' },
  45. * { text: 'Volume', dataIndex: 'volume', xtype: 'numbercolumn', format:'0,000' }
  46. * ],
  47. * height: 200,
  48. * width: 400,
  49. * renderTo: Ext.getBody()
  50. * });
  51. */
  52. Ext.define('Ext.grid.column.Number', {
  53. extend: 'Ext.grid.column.Column',
  54. alias: ['widget.numbercolumn'],
  55. requires: ['Ext.util.Format'],
  56. alternateClassName: 'Ext.grid.NumberColumn',
  57. //&lt;locale&gt;
  58. <span id='Ext-grid-column-Number-cfg-format'> /**
  59. </span> * @cfg {String} format
  60. * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column.
  61. */
  62. format : '0,000.00',
  63. //&lt;/locale&gt;
  64. <span id='Ext-grid-column-Number-cfg-renderer'> /**
  65. </span> * @cfg renderer
  66. * @hide
  67. */
  68. <span id='Ext-grid-column-Number-cfg-scope'> /**
  69. </span> * @cfg scope
  70. * @hide
  71. */
  72. defaultRenderer: function(value){
  73. return Ext.util.Format.number(value, this.format);
  74. }
  75. });</pre>
  76. </body>
  77. </html>