datebox清除按钮,datebox加上清除按钮,easyui datebox加上清除按钮

datebox加上清除按钮,easyui datebox加上清除按钮

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

蕃薯耀 2016年7月12日 16:27:22 星期二

http://fanshuyao.iteye.com/

一、问题描述:

easyui datebox本身是没有清除按钮的,在设置

data-options="editable:false"

 后,是不能直接修改的,但同时也不能清除选择的时间,所以需要加上一个清除的按钮。

二、解决方案

扩展按钮,并加上点击事件,在点击后清除之前的数据,js如下:

$(function(){
            var buttons = $.extend([], $.fn.datebox.defaults.buttons);
            buttons.splice(1, 0, {
                text: '清除',
                handler: function (target) {
                	$(target).datebox("setValue","");
                }
            });
            $('.easyui-datebox').datebox({
                buttons: buttons
            });
});

效果如下:



 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

蕃薯耀 2016年7月12日 16:27:22 星期二

http://fanshuyao.iteye.com/

原文地址:https://www.cnblogs.com/fanshuyao/p/6227114.html