Added functions for setting a "View" date which the date input will default open to
This commit is contained in:
@@ -103,6 +103,19 @@ $.extend(dateInputBinding, {
|
||||
}
|
||||
}
|
||||
},
|
||||
setView: function(el, view) {
|
||||
var $el = $(el);
|
||||
var $input = $el.find('input').eq(0);
|
||||
|
||||
if (view !== void 0) {
|
||||
if (view === null || (Array.isArray(view) && view.length == 0)) {
|
||||
$input.data().datepicker.o.defaultViewDate = new Date();
|
||||
} else {
|
||||
$input.data().datepicker.o.defaultViewDate = new Date(view);
|
||||
}
|
||||
$input.bsDatepicker('update');
|
||||
}
|
||||
},
|
||||
subscribe: function(el, callback) {
|
||||
$(el).on('change', function(event) {
|
||||
callback();
|
||||
@@ -136,6 +149,10 @@ $.extend(dateInputBinding, {
|
||||
this.setValue(el, data.value);
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('view')) {
|
||||
this.setView(el, data.view);
|
||||
}
|
||||
|
||||
// if (data.hasOwnProperty('disabled')) {
|
||||
// }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user