您的位置:首页 > 产品设计 > UI/UE

EasyUI 1.3.6 DateBox添加清空按钮

2016-01-15 19:50 525 查看
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 = '清空';
因为打开此文件一目了然,相信你应该知道添加在什么地方。 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: