5 Roo.form.DateDisplay = function(config){
7 config.listener = config.listener || {};
8 var c = Roo.apply({}, config);
10 Roo.form.DateDisplay.superclass.constructor.call(this, config);
17 this.picker = new Roo.DatePicker( c );
22 * Fires when a date is selected
23 * @param {DatePicker} this
24 * @param {Date} date The selected date
29 * Fires when the displayed month changes
30 * @param {DatePicker} this
31 * @param {Date} date The selected month
37 this.picker.on('select', this.onSelect, this);
41 Roo.extend(Roo.form.DateDisplay , Roo.form.TextField , {
45 onRender : function(ct, position)
47 Roo.form.TextField.superclass.onRender.call(this, ct, position);
50 this.el.dom.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
51 // prevent input submission
53 // now render the field..
54 this.wrap = this.el.wrap();
56 this.viewEl = this.wrap.createChild({ tag: 'div', cls: 'x-form-displayfield'});
58 this.picker.onRender(this.viewEl, position);
61 onSelect : function(sel) {
63 if (this.picker.value) {
64 this.setValue(this.picker.value.format('Y-m-d'));
65 this.fireEvent('select', this);