解决easy ui 1.4datebox控件不能清空的问题

用easy ui遇到这个问题,在网上找到了解决方案,不过是1.3.6版本的。现提供1.4版本的修改的具体位置和代码。

我们用的是这个

修改位置:12739行,添加代码:

1 , {
2     text: function (_987) {
3         return $(_987).datebox("options").cleanText;
4     },
5     handler: function (_988) {
6         $(_988).combo("setValue", "").combo("setText", ""); 
7         $(_988).combo("hidePanel"); 
8     }
9 }

修改下面的代码的数字,修改为:

1 , {
2     text: function (_989) {
3 return $(_989).datebox("options").closeText;
4 },handler:function(_990){
5 $(this).closest("div.combo-panel").panel("close");
6 }}

最终的buttons里的代码是:

 1 buttons:[{text:function(_985){
 2 return $(_985).datebox("options").currentText;
 3 },handler:function(_986){
 4 $(_986).datebox("calendar").calendar({year:new Date().getFullYear(),month:new Date().getMonth()+1,current:new Date()});
 5 _975(_986);
 6 }
 7 }, {
 8     text: function (_987) {
 9         return $(_987).datebox("options").cleanText;
10     },
11     handler: function (_988) {
12         $(_988).combo("setValue", "").combo("setText", ""); 
13         $(_988).combo("hidePanel"); 
14     }
15 }, {
16     text: function (_989) {
17 return $(_989).datebox("options").closeText;
18 },handler:function(_990){
19 $(this).closest("div.combo-panel").panel("close");
20 }}]

在汉化包相应位置添加代码:

 1 $.fn.datebox.defaults.cleanText = '清空'; 

原文地址:https://www.cnblogs.com/zzgblog/p/4111072.html