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-Date'>/**
19 </span> * @class Ext.grid.column.Date
20 * @extends Ext.grid.column.Column
22 * A Column definition class which renders a passed date according to the default locale, or a configured
25 * {@img Ext.grid.column.Date/Ext.grid.column.Date.png Ext.grid.column.Date grid column}
29 * Ext.create('Ext.data.Store', {
30 * storeId:'sampleStore',
32 * {name: 'symbol', type: 'string'},
33 * {name: 'date', type: 'date'},
34 * {name: 'change', type: 'number'},
35 * {name: 'volume', type: 'number'},
36 * {name: 'topday', type: 'date'}
39 * {symbol:"msft", date:'2011/04/22', change:2.43, volume:61606325, topday:'04/01/2010'},
40 * {symbol:"goog", date:'2011/04/22', change:0.81, volume:3053782, topday:'04/11/2010'},
41 * {symbol:"apple", date:'2011/04/22', change:1.35, volume:24484858, topday:'04/28/2010'},
42 * {symbol:"sencha", date:'2011/04/22', change:8.85, volume:5556351, topday:'04/22/2010'}
46 * Ext.create('Ext.grid.Panel', {
47 * title: 'Date Column Demo',
48 * store: Ext.data.StoreManager.lookup('sampleStore'),
50 * {text: 'Symbol', dataIndex: 'symbol', flex: 1},
51 * {text: 'Date', dataIndex: 'date', xtype: 'datecolumn', format:'Y-m-d'},
52 * {text: 'Change', dataIndex: 'change', xtype: 'numbercolumn', format:'0.00'},
53 * {text: 'Volume', dataIndex: 'volume', xtype: 'numbercolumn', format:'0,000'},
54 * {text: 'Top Day', dataIndex: 'topday', xtype: 'datecolumn', format:'l'}
58 * renderTo: Ext.getBody()
63 Ext.define('Ext.grid.column.Date', {
64 extend: 'Ext.grid.column.Column',
65 alias: ['widget.datecolumn'],
66 requires: ['Ext.Date'],
67 alternateClassName: 'Ext.grid.DateColumn',
69 <span id='Ext-grid-column-Date-cfg-format'> /**
70 </span> * @cfg {String} format
71 * A formatting string as used by {@link Date#format Date.format} to format a Date for this Column.
72 * This defaults to the default date from {@link Ext.Date#defaultFormat} which itself my be overridden
75 format : Ext.Date.defaultFormat,
77 constructor: function(cfg){
78 this.callParent(arguments);
79 this.renderer = Ext.util.Format.dateRenderer(this.format);