当前位置:网站首页>easyui 日期控件清空值
easyui 日期控件清空值
2022-07-07 18:43:00 【全栈程序员站长】
大家好,又见面了,我是全栈君。
近期用了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
});
}
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116440.html原文链接:https://javaforall.cn
边栏推荐
- You want to kill a port process, but you can't find it in the service list. You can find this process and kill it through the command line to reduce restarting the computer and find the root cause of
- Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
- 目前股票开户安全吗?可以直接网上开户吗。
- Écrivez une liste de sauts
- 4G设备接入EasyGBS平台出现流量消耗异常,是什么原因?
- Phoenix JDBC
- H3C s7000/s7500e/10500 series post stack BFD detection configuration method
- 备份 TiDB 集群到持久卷
- Mongodb由浅入深学习
- Prometheus remote_write InfluxDB,unable to parse authentication credentials,authorization failed
猜你喜欢
How does codesonar help UAVs find software defects?
让这个CRMEB单商户微信商城系统火起来,太好用了!
Tensorflow2. How to run under x 1 Code of X
C语言 整型 和 浮点型 数据在内存中存储详解(内含原码反码补码,大小端存储等详解)
I Basic concepts
How to meet the dual needs of security and confidentiality of medical devices?
H3C s7000/s7500e/10500 series post stack BFD detection configuration method
Implement secondary index with Gaussian redis
Network principle (1) - overview of basic principles
不落人后!简单好用的低代码开发,快速搭建智慧管理信息系统
随机推荐
Micro service remote debug, nocalhost + rainbow micro service development second bullet
软件缺陷静态分析 CodeSonar 5.2 新版发布
Numerical method for solving optimal control problem (0) -- Definition
POJ 1742 coins (monotone queue solution) [suggestions collection]
Write a jump table
[solution] package 'XXXX' is not in goroot
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
九度 1201 -二叉排序数遍历- 二叉排序树「建议收藏」
Data sorting in string
Écrivez une liste de sauts
CodeSonar网络研讨会
万字总结数据存储,三大知识点
阿里云有奖体验:如何通过ECS挂载NAS文件系统
解决/bin/sh进去的容器运行可执行文件报not found的问题
Spark judges that DF is empty
使用高斯Redis实现二级索引
FTP steps for downloading files from Huawei CE switches
Deep learning model compression and acceleration technology (VII): mixed mode
Klocwork code static analysis tool
【解决】package ‘xxxx‘ is not in GOROOT