5 Roo.form.DateDisplay = function(config){
8 Roo.form.DateDisplay.superclass.constructor.call(this, config);
9 config.listener = config.listener || {};
10 var c = Roo.apply({}, config);
13 this.picker = new Roo.DatePicker( c );
18 * Fires when a date is selected
19 * @param {DatePicker} this
20 * @param {Date} date The selected date
25 * Fires when the displayed month changes
26 * @param {DatePicker} this
27 * @param {Date} date The selected month
33 this.picker.on('select', this.onSelect, this);
37 Roo.extend(Roo.form.DateDisplay , Roo.form.TextField , {
41 onRender : function(ct, position)
43 Roo.form.TextField.superclass.onRender.call(this, ct, position);
46 this.el.dom.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
47 // prevent input submission
49 // now render the field..
50 this.wrap = this.el.wrap();
52 this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
54 this.picker.onRender(this.viewEl, position);
57 onSelect : function(sel) {
59 if (this.picker.value) {
60 this.setValue(this.picker.value.format('Y-m-d'));
61 this.fireEvent('select', this);