PDA

View Full Version : Clear button on Date Picker



ysagar
2 Jul 2009, 10:38 AM
I am trying to add a clear button on the date picker. Is there a way to add the button?
I made custom date field and a custom date picker. I want the custom date field to use the custom date picker. I am having problems as when I click on the trigger icon, I see a js error "addEvents" is not a function.

Any help would be much appreciated...

Al26
9 Oct 2009, 2:59 PM
Hello,

I tried this and it' ok. Delay needed because "this.picker.el" is undefined before.



var searchDatePickerStart = new Ext.menu.DateMenu({
format: 'Y-m-d',
hideOnClick: false,
maxDate: now,
handler: function(dp, date) {
...
},
listeners: {
'afterrender' : function () {
this.picker.todayBtn.addClass('clear-dp');
new Ext.Button({
renderTo: this.picker.el.child('td.x-date-bottom', true),
text: "Reset",
cls: 'clear-dp',
//handler: function() {},
scope: this
});
},delay: 100
}
});

.clear-dp {
display:inline;margin-right:5px
}

Problem : A little display margin bug appears in Firefox 3.

That's all folks