4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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> * @class Ext.grid.column.Number
20 * @extends Ext.grid.column.Column
22 * A Column definition class which renders a numeric data field according to a {@link #format} string.
24 * {@img Ext.grid.column.Number/Ext.grid.column.Number.png Ext.grid.column.Number cell editing}
27 * Ext.create('Ext.data.Store', {
28 * storeId:'sampleStore',
30 * {name: 'symbol', type: 'string'},
31 * {name: 'price', type: 'number'},
32 * {name: 'change', type: 'number'},
33 * {name: 'volume', type: 'number'},
36 * {symbol:"msft", price:25.76, change:2.43, volume:61606325},
37 * {symbol:"goog", price:525.73, change:0.81, volume:3053782},
38 * {symbol:"apple", price:342.41, change:1.35, volume:24484858},
39 * {symbol:"sencha", price:142.08, change:8.85, volume:5556351}
43 * Ext.create('Ext.grid.Panel', {
44 * title: 'Number Column Demo',
45 * store: Ext.data.StoreManager.lookup('sampleStore'),
47 * {text: 'Symbol', dataIndex: 'symbol', flex: 1},
48 * {text: 'Current Price', dataIndex: 'price', renderer: Ext.util.Format.usMoney},
49 * {text: 'Change', dataIndex: 'change', xtype: 'numbercolumn', format:'0.00'},
50 * {text: 'Volume', dataIndex: 'volume', xtype: 'numbercolumn', format:'0,000'}
54 * renderTo: Ext.getBody()
57 Ext.define('Ext.grid.column.Number', {
58 extend: 'Ext.grid.column.Column',
59 alias: ['widget.numbercolumn'],
60 requires: ['Ext.util.Format'],
61 alternateClassName: 'Ext.grid.NumberColumn',
63 <span id='Ext-grid-column-Number-cfg-format'> /**
64 </span> * @cfg {String} format
65 * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column
66 * (defaults to <code>'0,000.00'</code>).
69 constructor: function(cfg) {
70 this.callParent(arguments);
71 this.renderer = Ext.util.Format.numberRenderer(this.format);