Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / Number2.html
1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-grid.column.Number'>/**
2 </span> * @class Ext.grid.column.Number
3  * @extends Ext.grid.column.Column
4  *
5  * A Column definition class which renders a numeric data field according to a {@link #format} string.
6  *
7  * {@img Ext.grid.column.Number/Ext.grid.column.Number.png Ext.grid.column.Number cell editing}
8  *
9  * ## Code
10  *     Ext.create('Ext.data.Store', {
11  *        storeId:'sampleStore',
12  *        fields:[
13  *            {name: 'symbol', type: 'string'},
14  *            {name: 'price', type: 'number'},
15  *            {name: 'change', type: 'number'},
16  *            {name: 'volume', type: 'number'},            
17  *        ],
18  *        data:[
19  *            {symbol:&quot;msft&quot;, price:25.76, change:2.43, volume:61606325},
20  *            {symbol:&quot;goog&quot;, price:525.73, change:0.81, volume:3053782},
21  *            {symbol:&quot;apple&quot;, price:342.41, change:1.35, volume:24484858},            
22  *            {symbol:&quot;sencha&quot;, price:142.08, change:8.85, volume:5556351}            
23  *        ]
24  *     });
25  *     
26  *     Ext.create('Ext.grid.Panel', {
27  *         title: 'Number Column Demo',
28  *         store: Ext.data.StoreManager.lookup('sampleStore'),
29  *         columns: [
30  *             {text: 'Symbol',  dataIndex: 'symbol', flex: 1},
31  *             {text: 'Current Price',  dataIndex: 'price', renderer: Ext.util.Format.usMoney},
32  *             {text: 'Change',  dataIndex: 'change', xtype: 'numbercolumn', format:'0.00'},
33  *             {text: 'Volume',  dataIndex: 'volume', xtype: 'numbercolumn', format:'0,000'}
34  *         ],
35  *         height: 200,
36  *         width: 400,
37  *         renderTo: Ext.getBody()
38  *     });
39  * 
40  * @xtype numbercolumn
41  */
42 Ext.define('Ext.grid.column.Number', {
43     extend: 'Ext.grid.column.Column',
44     alias: ['widget.numbercolumn'],
45     requires: ['Ext.util.Format'],
46     alternateClassName: 'Ext.grid.NumberColumn',
47
48 <span id='Ext-grid.column.Number-cfg-format'>    /**
49 </span>     * @cfg {String} format
50      * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column
51      * (defaults to &lt;code&gt;'0,000.00'&lt;/code&gt;).
52      */
53     format : '0,000.00',
54     constructor: function(cfg) {
55         this.callParent(arguments);
56         this.renderer = Ext.util.Format.numberRenderer(this.format);
57     }
58 });</pre></pre></body></html>