Skip to content

Commit 08eee35

Browse files
committed
Merge branch 'devel'
2 parents 2bb2233 + 35ee861 commit 08eee35

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

jquery.comiseo.daterangepicker.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
var uniqueId = 0; // used for unique ID generation within multiple plugin instances
1515

1616
$.widget('comiseo.daterangepicker', {
17-
version: '0.3.5',
17+
version: '0.4.0',
1818

1919
options: {
2020
// presetRanges: array of objects; each object describes an item in the presets menu
@@ -33,6 +33,7 @@
3333
initialText: 'Select date range...', // placeholder text - shown when nothing is selected
3434
icon: 'ui-icon-triangle-1-s',
3535
applyButtonText: 'Apply',
36+
clearButtonText: 'Clear',
3637
cancelButtonText: 'Cancel',
3738
rangeSplitter: ' - ', // string to use between dates
3839
dateFormat: 'M d, yy', // displayed date format. Available formats: http://api.jqueryui.com/datepicker/#utility-formatDate
@@ -268,19 +269,24 @@
268269
function buildButtonPanel(classnameContext, options, handlers) {
269270
var $self,
270271
applyButton,
272+
clearButton,
271273
cancelButton;
272274

273275
function init() {
274276
applyButton = $('<button type="button" class="ui-priority-primary"></button>')
275277
.text(options.applyButtonText)
276278
.button();
279+
clearButton = $('<button type="button" class="ui-priority-secondary"></button>')
280+
.text(options.clearButtonText)
281+
.button();
277282
cancelButton = $('<button type="button" class="ui-priority-secondary"></button>')
278283
.text(options.cancelButtonText)
279284
.button();
280285

281286
$self = $('<div></div>')
282287
.addClass(classnameContext + '-buttonpanel')
283288
.append(applyButton)
289+
.append(clearButton)
284290
.append(cancelButton);
285291

286292
bindEvents();
@@ -289,6 +295,7 @@
289295
function bindEvents() {
290296
if (handlers) {
291297
applyButton.click(handlers.onApply);
298+
clearButton.click(handlers.onClear);
292299
cancelButton.click(handlers.onCancel);
293300
}
294301
}
@@ -336,6 +343,10 @@
336343
close();
337344
setRange();
338345
},
346+
onClear: function() {
347+
close();
348+
clearRange();
349+
},
339350
onCancel: function() {
340351
close();
341352
reset();
@@ -461,6 +472,7 @@
461472
function clearRange() {
462473
triggerButton.reset();
463474
calendar.reset();
475+
$originalElement.val('');
464476
}
465477

466478
// callback - used when the user clicks a preset range

0 commit comments

Comments
 (0)