5 Roo.form.DateDisplay = function(config){
8 Roo.form.DateDisplay.superclass.constructor.call(this, config);
9 config.listener = config.listener || {};
11 var c = Roo.apply({}, config);
15 this.picker = new Roo.DatePicker( c );
20 * Fires when a date is selected
21 * @param {DatePicker} this
22 * @param {Date} date The selected date
27 * Fires when the displayed month changes
28 * @param {DatePicker} this
29 * @param {Date} date The selected month
35 this.picker.on('select', this.onSelect, this);
39 Roo.extend(Roo.form.DateDisplay , Roo.form.TextField , {
43 onRender : function(ct, position)
45 Roo.form.TextField.superclass.onRender.call(this, ct, position);
48 this.el.dom.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
49 // prevent input submission
51 // now render the field..
52 this.wrap = this.el.wrap();
54 this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
56 this.picker.onRender(this.viewEl, position);
59 onSelect : function(sel) {
61 if (this.picker.value) {
62 this.setValue(this.picker.value.format('Y-m-d'));
63 this.fireEvent('select', this);