I need to be able to change a datetimebox field to a datebox (to remove the time component for an 'all-day' event) and vice versa.
I tried the technique in this thread
http://www.jeasyui.com/forum/index.php?topic=1761.0 but couldn't get it to work:
$.extend($.fn.datetimebox.methods, {
removeTime: function(jq){
return jq.each(function() {
var state = $.data(this,'datetimebox');
if (state) {
state.spinner.panel('destroy');
state.datetimebox.remove();
$(this).removeClass('easyui-datetimebox').show();
$.removeData(this,'datetimebox');
}
$(this).addClass('easyui-datebox').show();
if (state)
$.setData(this, 'datebox', state);
});
},
addTime: function(jq){
return jq.each(function() {
var state = $.data(this,'datebox');
if (state) {
state.spinner.panel('destroy');
state.calendar.remove();
$(this).removeClass('easyui-datebox').show();
$.removeData(this,'datebox');
}
$(this).addClass('easyui-datetimebox').show();
if (state)
$.setData(this, 'datetimebox', state);
});
}
});
What am I doing wrong? Or is there a better way to do this?