• easyui 日期控件清空值


    近期用了Easyui的日期控件datebox,项目中要将选中值清空,于是就研究了一下。


         1。调用方法清空

    $('#yourId').combo('setText','');
       

         2,更改js文件

         从官网下载的源文件里。datebox控件界面仅仅有‘Today’。‘Close’事件。我们能够把清空选项值的事件加入到js中去,这样,仅仅要引用了datebox这个控件,界面上就会有清空选项。详细改动过程例如以下:

         首先在官网上下载jquery.easyui.min.js文件。

         在js文件里找到Today Close事件定义的地方,并加入Clean事件的定义。

       

         源文件说明:

        

        将源文件12733--12742行文件替换为:


      代码:

    }},currentText:"Today",cleanText:"Clean",closeText:"Close",okText:"Ok",buttons:[{text:function(_985){
    return $(_985).datebox("options").currentText;
    },handler:function(_986){
    $(_986).datebox("calendar").calendar({year:new Date().getFullYear(),month:new Date().getMonth()+1,current:new Date()});
    _975(_986);
    }},{text:function(_987){
    return $(_987).datebox("options").closeText;
    },handler:function(_988){
    $(this).closest("div.combo-panel").panel("close");
    }},{ text : function(_989) {
    
    return $(_989).datebox("options").cleanText;
    
    },handler : function(_990) {
    
    $(_990).combo('setValue', '').combo('setText', '');
    
    $(this).closest("div.combo-panel").panel("close");
    
    }}],formatter:function(date){

        界面效果例如以下:



        3,中文js更改

        上面我们把源js改好了,仅仅只是界面显示的是英文,假设用了中文包的话,还须要更改easyui-lang-zh_CN.js

        在js文件里找到‘今天’ ‘关闭 ’事件定义的地方,并加入‘清空’

     

        代码:

    	$.fn.datebox.defaults.currentText = '今天';
    	$.fn.datebox.defaults.closeText = '关闭';
    	$.fn.datebox.defaults.cleanText = '清空';
        


       改动事件:

                 
        代码:

    if ($.fn.datetimebox && $.fn.datebox){
    	$.extend($.fn.datetimebox.defaults,{
    		cleanText: $.fn.datebox.defaults.cleanText,
    		currentText: $.fn.datebox.defaults.currentText,
    		closeText: $.fn.datebox.defaults.closeText,
    		okText: $.fn.datebox.defaults.okText,
    		missingMessage: $.fn.datebox.defaults.missingMessage
    	});
    }


  • 相关阅读:
    洛谷P1586 四方定理
    洛谷P3807 【模板】卢卡斯定理exgcd
    扩展中国剩余定理详解
    HDU 1573 X问题
    POJ 2891 Strange Way to Express Integers
    中国剩余定理详解
    java.lang.UnsupportedClassVersionError: Bad version number in .class file 解决方案
    MySQL对于有大量重复数据表的处理方法
    【一牛鸣】下周或触发新变盘9.16
    Django里面的RequestContext
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5098472.html
Copyright © 2020-2023  润新知