Skip to content

Commit

Permalink
Merge pull request #2163 from dertin/master
Browse files Browse the repository at this point in the history
Add settings for input type date.
  • Loading branch information
hikalkan authored Oct 24, 2018
2 parents 81963ba + 7dc7249 commit 8338697
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
10 changes: 7 additions & 3 deletions dev/jquery.jtable.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(function ($) {

var unloadingPage;

$(window).on('beforeunload', function () {
unloadingPage = true;
});
Expand All @@ -24,6 +24,10 @@
fields: {},
animationsEnabled: true,
defaultDateFormat: 'yy-mm-dd',
defaultChangeMonth: false,
defaultChangeYear: false,
defaultYearRange: 'c-10:c+10',
defaultMaxDate: null,
dialogShowEffect: 'fade',
dialogHideEffect: 'fade',
showCloseButton: false,
Expand Down Expand Up @@ -119,7 +123,7 @@
this._createErrorDialogDiv();
this._addNoDataRow();

this._cookieKeyPrefix = this._generateCookieKeyPrefix();
this._cookieKeyPrefix = this._generateCookieKeyPrefix();
},

/* Normalizes some options for all fields (sets default values).
Expand Down Expand Up @@ -1240,7 +1244,7 @@
jqXHR.abort();
return;
}

if (options.error) {
options.error(arguments);
}
Expand Down
25 changes: 18 additions & 7 deletions dev/jquery.jtable.forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,20 @@
if(value != undefined) {
$input.val(value);
}

var displayFormat = field.displayFormat || this.options.defaultDateFormat;
$input.datepicker({ dateFormat: displayFormat });
var changeMonth = field.changeMonth || this.options.defaultChangeMonth;
var changeYear = field.changeYear || this.options.defaultChangeYear;
var yearRange = field.yearRange || this.options.defaultYearRange;
var maxDate = field.maxDate || this.options.defaultMaxDate;

$input.datepicker({
dateFormat: displayFormat,
changeMonth: changeMonth,
changeYear: changeYear,
yearRange: yearRange,
maxDate: maxDate
});
return $('<div />')
.addClass('jtable-input jtable-date-input')
.append($input);
Expand All @@ -120,7 +131,7 @@
if (value != undefined) {
$textArea.val(value);
}

return $('<div />')
.addClass('jtable-input jtable-textarea-input')
.append($textArea);
Expand All @@ -133,7 +144,7 @@
if (value != undefined) {
$input.val(value);
}

return $('<div />')
.addClass('jtable-input jtable-text-input')
.append($input);
Expand All @@ -146,7 +157,7 @@
if (value != undefined) {
$input.val(value);
}

return $('<div />')
.addClass('jtable-input jtable-password-input')
.append($input);
Expand Down Expand Up @@ -236,7 +247,7 @@

return $containerDiv;
},

/* Fills a dropdown list with given options.
*************************************************************************/
_fillDropDownListWithOptions: function ($select, options, value) {
Expand Down Expand Up @@ -373,7 +384,7 @@
}

var field = self.options.fields[fieldName];

//check if this combobox depends on others
if (!field.dependsOn) {
return;
Expand Down

0 comments on commit 8338697

Please sign in to comment.