解决Bootstrap日期插件Date Range Picker清空的问题
来源:互联网 发布:学打五笔用什么软件 编辑:程序博客网 时间:2024/03/29 21:27
Date Range Picker日期插件清空
一般日期插件都有清空的功能,而Date Range Picker似乎并没有,因为使用的bootstrap框架,所以为了页面统一使用了date range picker,所以稍微做了一下改动:
本文使用的Date Range Picker版本为1.3.6,Bootstrap版本为3.3.7。 —— [ Date Range Picker地址 ]
代码块
在daterangepicker.js中找到取消按钮的点击方法,如下:
clickCancel: function (e) { this.startDate = this.oldStartDate; this.endDate = this.oldEndDate; this.chosenLabel = this.oldChosenLabel; this.updateView(); this.updateCalendars(); this.hide(); this.element.trigger('cancel.daterangepicker', this); },
可以看到点击取消的时候只是隐藏了日期选择部分,我们可以添加一个清空的方法clearInputText()。
this.hide();
clickCancel: function (e) { this.startDate = this.oldStartDate; this.endDate = this.oldEndDate; this.chosenLabel = this.oldChosenLabel; this.updateView(); this.updateCalendars(); this.hide(); this.element.trigger('cancel.daterangepicker', this); this.clearInputText();},
添加的方法如下:
clearInputText: function() { this.element.val(''); },
还有一步就是看你是否需要把取消改为清空了
this.locale = { applyLabel: '确定', cancelLabel: '清空', fromLabel: '从', toLabel: '到', weekLabel: 'W', customRangeLabel: 'Custom Range', daysOfWeek: moment()._lang._weekdaysMin.slice(), monthNames: moment()._lang._monthsShort.slice(), firstDay: 0 };
阅读全文
0 0
- 解决Bootstrap日期插件Date Range Picker清空的问题
- Date Range Picker 插件 bootstrap
- Bootstrap的日期选择插件DateTime Picker
- 修复bootstrap daterangepicker不能清空日期的问题
- bootstrap datetimepicker 日期控件清空问题
- 日期选择器react-bootstrap-date-picker的使用
- jQuery Date Range Picker时间插件API
- 强大的独立日期选择器(date picker)插件 - Kalendae
- Bootstrap的日期选择插件DateTime Picker增强版
- Bootstrap的日期选择插件DateTime Picker增强版
- yii2框架中引用bootstrap中的日期插件yii2-date-picker
- JQ插件:日期时间选择器date picker
- jQuery Date Range Picker
- Yii 2.0 时间日期插件之yii2-date-picker-widget
- bootstrap之双日历时间段选择控件Date Range Picker
- Date Range Picker和bootstrapValidator同时使用时,选择日期后无法正常触发校验
- Extjs日期控件(date),文本框(textfield)和下拉(combo)的清空控件
- 我的组件库--java Date Picker 日历 日期选择器
- 代码块的执行问题
- C++类的声明和对象的定义——形式1
- 数学基础
- Hibernate搭建开发环境+简单实例(二)
- bzoj 2820 YY的GCD(莫比乌斯)
- 解决Bootstrap日期插件Date Range Picker清空的问题
- 数学符号及读法大全
- hash去重及应用-【leetcode219-Contains Duplicate II】
- 【OJ】 还不错的(较)冷门OJ
- Android之ClassLoader类加载器(MultiDex、动态加载dex)
- 网易im聊天室的集成
- 【PHP基础知识】——服务器相关参数及其含义
- XML 特殊字符处理
- Git初识(一)