Skip to content

Commit

Permalink
Trigger changeDate on keyboard navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
eternicode committed Apr 16, 2012
1 parent 7b406db commit 9e1969d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion js/bootstrap-datepicker.js
Expand Up @@ -475,7 +475,8 @@
this.show();
return;
}
var dir, day, month;
var dateChanged = false,
dir, day, month;
switch(e.keyCode){
case 27: // escape
this.hide();
Expand All @@ -497,6 +498,7 @@
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
break;
case 38: // up
case 40: // down
Expand All @@ -514,12 +516,28 @@
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
break;
case 13: // enter
this.hide();
e.preventDefault();
break;
}
if (dateChanged){
this.element.trigger({
type: 'changeDate',
date: this.date
});
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
}
}
},

showMode: function(dir) {
Expand Down

0 comments on commit 9e1969d

Please sign in to comment.