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; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
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.
22 * Ext.create('Ext.data.Store', {
23 * storeId:'sampleStore',
25 * { name: 'symbol', type: 'string' },
26 * { name: 'price', type: 'number' },
27 * { name: 'change', type: 'number' },
28 * { name: 'volume', type: 'number' },
31 * { symbol: "msft", price: 25.76, change: 2.43, volume: 61606325 },
32 * { symbol: "goog", price: 525.73, change: 0.81, volume: 3053782 },
33 * { symbol: "apple", price: 342.41, change: 1.35, volume: 24484858 },
34 * { symbol: "sencha", price: 142.08, change: 8.85, volume: 5556351 }
38 * Ext.create('Ext.grid.Panel', {
39 * title: 'Number Column Demo',
40 * store: Ext.data.StoreManager.lookup('sampleStore'),
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' }
49 * renderTo: Ext.getBody()
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',
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.
64 constructor: function(cfg) {
65 this.callParent(arguments);
66 this.renderer = Ext.util.Format.numberRenderer(this.format);