datefield test ready

This commit is contained in:
vitalets
2013-01-04 17:37:22 +04:00
parent 5dfa8bb218
commit 9492610a9a
5 changed files with 148 additions and 13 deletions

@ -26,13 +26,13 @@ $(function(){
var Date = function (options) {
this.init('date', options, Date.defaults);
this.initPicker();
this.initPicker(options, Date.defaults);
};
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
$.extend(Date.prototype, {
initPicker: function() {
initPicker: function(options, defaults) {
//'format' is set directly from settings or data-* attributes
//by default viewformat equals to format
@ -42,7 +42,7 @@ $(function(){
//overriding datepicker config (as by default jQuery extend() is not recursive)
//since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only
this.options.datepicker = $.extend({}, Date.defaults.datepicker, this.options.datepicker, {
this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, {
format: this.options.viewformat
});

@ -7,7 +7,7 @@ Automatically shown in inline mode.
var DateField = function (options) {
this.init('datefield', options, DateField.defaults);
this.initPicker();
this.initPicker(options, DateField.defaults);
};
$.fn.editableutils.inherit(DateField, $.fn.editabletypes.date);
@ -28,12 +28,14 @@ Automatically shown in inline mode.
this.$input.datepicker(this.options.datepicker);
//need to disable original event handlers
this.$field.off('focus keyup keydown');
this.$field.off('focus keydown');
//shadow update value of datepicker
//update value of datepicker
this.$field.keyup($.proxy(function(){
this.$input.data('datepicker').date = this.input2value();
this.$input.removeData('date');
this.$input.datepicker('update');
}, this));
},
value2str: function(value) {
@ -76,7 +78,14 @@ Automatically shown in inline mode.
@default ''
**/
inputclass: '',
datepicker: {autoclose: true},
datepicker: {
weekStart: 0,
startView: 0,
autoclose: true,
keyboardNavigation: false
},
clear: false
});