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);
14 this.picker = new Roo.DatePicker( c );
19 * Fires when a date is selected
20 * @param {DatePicker} this
21 * @param {Date} date The selected date
26 * Fires when the displayed month changes
27 * @param {DatePicker} this
28 * @param {Date} date The selected month
34 this.picker.on('select', this.onSelect, this);
38 Roo.extend(Roo.form.DateDisplay , Roo.form.TextField , {
42 onRender : function(ct, position)
44 Roo.form.TextField.superclass.onRender.call(this, ct, position);
47 this.el.dom.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
48 // prevent input submission
50 // now render the field..
51 this.wrap = this.el.wrap();
53 this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
55 this.picker.onRender(this.viewEl, position);
58 onSelect : function(sel) {
60 if (this.picker.value) {
61 this.setValue(this.picker.value.format('Y-m-d'));
62 this.fireEvent('select', this);