EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: itay-g on May 04, 2014, 04:41:24 AM



Title: datetime box today button
Post by: itay-g on May 04, 2014, 04:41:24 AM
hey
i need the today button to set not only the current day also the current hour and minutes
how can i do it?
is there an event of today button click that i can override?

thnx!


Title: Re: datetime box today button
Post by: stworthy on May 04, 2014, 07:39:09 AM
You can override the $.fn.datetimebox.defaults.buttons to custom their behaviors.
Code:
<script type="text/javascript">
$.fn.datetimebox.defaults.buttons[0] = {
text: function(target){return $(target).datetimebox('options').currentText;},
handler: function(target){
var opts = $(target).datetimebox('options');
$(target).datetimebox('setValue', opts.formatter.call(target, new Date()));
$(target).datetimebox('hidePanel');
}

}
</script>