EasyUI 1.3.6 DateBox添加清空按钮

来源:互联网 发布:手机解压缩软件zip 编辑:程序博客网 时间:2024/06/07 20:19
EasyUI 1.3.6 DateBox添加清空按钮 

效果如图:

添加,datebox,按钮,easyui,1.3.60


EasyUI datebox是没有清空按钮的,可通过如下方法加入:

打开jquery.easyui.min.js看到这样如此乱的代码,我们只能使用Ctrl+F搜索功能

搜索currentText,在第一次搜索到的位置有个buttons数组,在今天("Today")与关闭("Close")中间添加清空。

{     text : function(_947) {   return $(_947).datebox("options").cleanText;     },     handler : function(_948) {   $(_948).combo("setValue", "").combo("setText", ""); //设置空值   $(_948).combo("hidePanel"); //点击清空按钮之后关闭日期选择面板     }},
添加之前可以Ctrl+Shift+F格式化一下,不然很难找到要插入的位置,最后代码插入后上下文应该是如下:
currentText : "Today",closeText : "Close",okText : "Ok",buttons : [ {text : function(_945) {return $(_945).datebox("options").currentText;},handler : function(_946) {$(_946).datebox("calendar").calendar( {year : new Date().getFullYear(),month : new Date().getMonth() + 1,current : new Date()});_935(_946);}}, {text : function(_947) {return $(_947).datebox("options").cleanText;},handler : function(_948) {$(_948).combo("setValue", "").combo("setText", ""); // 设置空值$(_948).combo("hidePanel"); // 点击清空按钮之后关闭日期选择面板}}, {text : function(_947) {return $(_947).datebox("options").closeText;},handler : function(_948) {$(this).closest("div.combo-panel").panel("close");}} ],
最后修改easyui-lang-zh_CN.js文件 加入如下语句
$.fn.datebox.defaults.cleanText = '清空';
因为打开此文件一目了然,相信你应该知道添加在什么地方。 
0 0