zl程序教程

您现在的位置是:首页 >  前端

当前栏目

EasyUI 1.3.6 DateBox添加清空按钮详解编程语言

EasyUI编程语言 详解 添加 清空 按钮 1.3
2023-06-13 09:20:42 时间

效果如图:

EasyUI 1.3.6 DateBox添加清空按钮详解编程语言

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 = 清空;

因为打开此文件一目了然,相信你应该知道添加在什么地方。


PS:此方法在EasyUI 1.3.6版本通过,其他版本或许可能略有不同,供参考。


作者:blog.ytso.com

出处:blog.ytso.com/article/details/39055937

14514.html

cjava