diff --git a/src/inputs/date/datefield.js b/src/inputs/date/datefield.js index 9272b610..9fb26a32 100644 --- a/src/inputs/date/datefield.js +++ b/src/inputs/date/datefield.js @@ -1,6 +1,6 @@ /** Bootstrap datefield input - modification for inline mode. -Shows normal and binds popup datepicker. +Shows normal and binds popup datepicker. Automatically shown in inline mode. @class datefield @@ -10,63 +10,63 @@ Automatically shown in inline mode. **/ (function ($) { "use strict"; - + var DateField = function (options) { this.init('datefield', options, DateField.defaults); this.initPicker(options, DateField.defaults); }; - $.fn.editableutils.inherit(DateField, $.fn.editabletypes.date); - + $.fn.editableutils.inherit(DateField, $.fn.editabletypes.date); + $.extend(DateField.prototype, { render: function () { this.$input = this.$tpl.find('input'); this.setClass(); this.setAttr('placeholder'); - - //bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js) - this.$tpl.bdatepicker(this.options.datepicker); - + + //bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js) + this.$input.bdatepicker(this.options.datepicker); + //need to disable original event handlers this.$input.off('focus keydown'); - + //update value of datepicker this.$input.keyup($.proxy(function(){ this.$tpl.removeData('date'); this.$tpl.bdatepicker('update'); }, this)); - - }, - + + }, + value2input: function(value) { this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : ''); this.$tpl.bdatepicker('update'); }, - - input2value: function() { + + input2value: function() { return this.html2value(this.$input.val()); - }, - + }, + activate: function() { $.fn.editabletypes.text.prototype.activate.call(this); }, - + autosubmit: function() { - //reset autosubmit to empty + //reset autosubmit to empty } }); - + DateField.defaults = $.extend({}, $.fn.editabletypes.date.defaults, { /** - @property tpl - **/ + @property tpl + **/ tpl:'
', /** - @property inputclass + @property inputclass @default 'input-small' - **/ + **/ inputclass: 'input-small', - + /* datepicker config */ datepicker: { weekStart: 0, @@ -75,7 +75,7 @@ Automatically shown in inline mode. autoclose: true } }); - + $.fn.editabletypes.datefield = DateField; -}(window.jQuery)); \ No newline at end of file +}(window.jQuery));