Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting lattest version #1

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
746047d
Improving pt_BR translation.
drovetto Oct 9, 2015
64bb976
Merge pull request #1839 from drovetto/master
hikalkan Oct 9, 2015
10f038c
Fixed #1861: Bug in _parseDate.
hikalkan Dec 5, 2015
5ed80e2
add translation
alcharkov Jan 26, 2016
06f76f2
Remove comments
alcharkov Jan 26, 2016
5ac28be
Merge pull request #1887 from alcharkov/master
hikalkan Jan 26, 2016
3b950b0
Fix mixed content HTTPS #1
Jan 27, 2016
7ebc7e4
Fix duplicate
Jan 27, 2016
4aeb7fd
Fix mixed content HTTPS #2
Jan 27, 2016
f4590ac
Fix mixed content HTTPS #3
Jan 27, 2016
f47d8fc
Fix mixed content HTTPS #4
Jan 27, 2016
cdf4dcd
Fix mixed content HTTPS #5
Jan 27, 2016
8eb6403
Fix mixed content HTTPS #6
Jan 27, 2016
dc23057
Fix mixed content HTTPS #7
Jan 27, 2016
b3f76f9
Fix mixed content HTTPS #8
Jan 27, 2016
c31d93e
Fix mixed content HTTPS #9
Jan 27, 2016
16c7ec0
Fix mixed content HTTPS #10
Jan 27, 2016
db5ba8b
Fix mixed content HTTPS #11
Jan 27, 2016
a7666dc
Fix mixed content HTTPS #12
Jan 27, 2016
a25bec7
Fix mixed content HTTPS #13
Jan 27, 2016
296161e
Fix mixed content HTTPS #14
Jan 27, 2016
37d41ac
Fix mixed content HTTPS #15
Jan 27, 2016
37ab01b
Fix mixed content HTTPS #16
Jan 27, 2016
ea3b909
Fix mixed content HTTPS #17
Jan 27, 2016
56777a4
Fix mixed content HTTPS #18
Jan 27, 2016
bd77963
Fix mixed content HTTPS #19
Jan 27, 2016
29b6efa
Fix mixed content HTTPS #20
Jan 27, 2016
47344fe
Fix mixed content HTTPS #21
Jan 27, 2016
994fd63
Fix mixed content HTTPS #22
Jan 27, 2016
9f12e1e
Fix mixed content HTTPS #23
Jan 27, 2016
4440b8c
Ukrainian localization (thanks to Volodymyr Sokolov)
hikalkan Feb 4, 2016
d5cbeb5
Merge pull request #1888 from HLFH/master
hikalkan Feb 12, 2016
8297eae
bugfix: 0 disappeared after updating a row
Eefimov Mar 19, 2016
bb411ad
Merge pull request #1916 from Eefimov/bugfix
hikalkan Mar 21, 2016
6347499
Add placeholder support
Apr 13, 2016
1a6e6ab
Merge pull request #1927 from biehlermi/add-placeholder
hikalkan Apr 14, 2016
820bd56
Update jquery.jtable.ar.js
sheryever Sep 8, 2016
52e0e0a
Update jquery.jtable.ar.js
sheryever Sep 8, 2016
833b4ec
Merge pull request #1978 from sheryever/master
hikalkan Sep 8, 2016
3feff4d
modify jquery.jtable.zh-CN.js
guomindong Sep 23, 2016
80591ed
Merge pull request #1986 from guomindong/master
hikalkan Sep 24, 2016
7d063cd
Tamil Localization for jtable (jquery.jtable.ta)
mpm2050 Oct 13, 2016
96474d6
Merge pull request #2001 from mpm2050/patch-1
hikalkan Oct 14, 2016
8028579
Incremented version to 2.4.1. Also added package.json.
hikalkan Oct 18, 2016
11827d2
implemented record actions dropdown plugin
ismcagdas Mar 29, 2017
6d6c92c
added jquery.jtable.record-actions.js
ismcagdas Mar 29, 2017
c73ed86
added extraFieldTypes property
ismcagdas Mar 29, 2017
3de27e9
added field type changes to jquery.jtable.core.js
ismcagdas Mar 29, 2017
a6dfb61
moved record-actions to extensions
ismcagdas Mar 29, 2017
9d26131
removed record-actiosn from jtable
ismcagdas Mar 29, 2017
4609152
Send parameters to click action as object. Implemented enabled property.
ismcagdas Mar 29, 2017
bcd862d
Merge pull request #2038 from ismcagdas/master
hikalkan Mar 29, 2017
15ca9d8
#1459: implement initial sorting direction
ismcagdas Mar 29, 2017
b36abf2
Merge remote-tracking branch 'refs/remotes/hikalkan/master'
ismcagdas Mar 29, 2017
e26cea1
Merge pull request #2040 from ismcagdas/master
hikalkan Mar 29, 2017
6b93b64
don't fire click event if dropdown item is disabled
ismcagdas Mar 29, 2017
f31e2f7
Increment version to 2.5.0
hikalkan Mar 30, 2017
1fe3c91
Create danish translation.
SirBisgaard Aug 14, 2017
445f789
Merge pull request #2095 from SirBisgaard/patch-2
hikalkan Aug 14, 2017
d98dc0f
Dutch additions
Dec 2, 2017
f7a1075
Dutch Belgium transltion
Dec 2, 2017
f428893
Merge pull request #2130 from liedekef/patch-1
hikalkan Dec 3, 2017
7dc7249
Add settings for input type date.
Apr 25, 2018
93e9afc
Extension method for cookies - replace cookies with session storage
falwickster Jul 5, 2018
812ff9a
Merge pull request #2175 from falwickster/patch-2
hikalkan Jul 5, 2018
3937249
added fieldOrder option to enable the user to control the fields' order
Revoluzifer Sep 8, 2018
d7b3d52
Added the support for ISO 8601 datetime
gpcaretti Oct 9, 2018
da2e465
Merge pull request #2189 from gpcaretti/patch-1
hikalkan Oct 24, 2018
81963ba
Added the support for ISO 8601 date/time formats #2189
hikalkan Oct 24, 2018
8338697
Merge pull request #2163 from dertin/master
hikalkan Oct 24, 2018
713c820
Merge pull request #2183 from Revoluzifer/FieldOrderOption
hikalkan Oct 24, 2018
e393d58
Update jquery.jtable.js
hikalkan Oct 24, 2018
347f97d
Increment version to 2.6
hikalkan Oct 24, 2018
5b4f8a7
Create jquery.jtable.th.js
anurat Nov 6, 2018
2d948ee
Merge pull request #2194 from anurat/master
hikalkan Nov 6, 2018
61a4cd1
Close delete dialog when getting error
Dec 22, 2018
dbb8010
Merge pull request #2203 from umaams/master
hikalkan Dec 23, 2018
7be7045
Add option formDialogWidth
Dec 24, 2018
c61fffc
Merge pull request #2204 from umaams/master
hikalkan Dec 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev/build
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"main": [
"lib/jquery.jtable.min.js"
],
"version": "2.4.0",
"version": "2.6.0",
"authors": [
"Halil ibrahim Kalkan <[email protected]>"
"Halil ibrahim Kalkan <[email protected]>"
],
"description": "A JQuery plugin to create AJAX based CRUD tables (grids). It supports paging, sorting, selecting, master/child tables, show/hide/resize columns, localization, themes and more.A JQuery plugin to create AJAX based CRUD tables (grids). It supports paging, sorting, selecting, master/child tables, show/hide/resize columns, localization, themes and more.",
"keywords": [
Expand All @@ -18,7 +18,7 @@
"sorting"
],
"license": "MIT",
"homepage": "http://www.jtable.orghttp://www.jtable.org",
"homepage": "http://www.jtable.org",
"ignore": [
"**/.*",
"node_modules",
Expand Down
2 changes: 1 addition & 1 deletion dev/jquery.jtable.build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ add jquery.jtable.selecting.js
add jquery.jtable.paging.js
add jquery.jtable.sorting.js
add jquery.jtable.dynamiccolumns.js
add jquery.jtable.masterchild.js
add jquery.jtable.masterchild.js
134 changes: 104 additions & 30 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 @@ -95,6 +99,8 @@

_cache: null, //General purpose cache dictionary (object)

_extraFieldTypes:[],

/************************************************************************
* CONSTRUCTOR AND INITIALIZATION METHODS *
*************************************************************************/
Expand All @@ -117,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 All @@ -138,6 +144,9 @@
if (props.inputClass == undefined) {
props.inputClass = '';
}
if (props.placeholder == undefined) {
props.placeholder = '';
}

//Convert dependsOn to array if it's a comma seperated lists
if (props.dependsOn && $.type(props.dependsOn) === 'string') {
Expand All @@ -157,6 +166,7 @@
this._columnList = [];
this._fieldList = [];
this._cache = [];
this._extraFieldTypes = [];
},

/* Fills _fieldList, _columnList arrays and sets _keyField variable.
Expand Down Expand Up @@ -708,7 +718,11 @@
return field.display({ record: record });
}

if (field.type == 'date') {
var extraFieldType = this._findItemByProperty(this._extraFieldTypes, 'type', field.type);
if(extraFieldType && extraFieldType.creator){
return extraFieldType.creator(record, field);
}
else if (field.type == 'date') {
return this._getDisplayTextForDateRecordField(field, fieldValue);
} else if (field.type == 'checkbox') {
return this._getCheckBoxTextForFieldByValue(fieldName, fieldValue);
Expand Down Expand Up @@ -743,13 +757,19 @@
/* Finds an option object by given value.
*************************************************************************/
_findOptionByValue: function (options, value) {
for (var i = 0; i < options.length; i++) {
if (options[i].Value == value) {
return options[i];
return this._findItemByProperty(options, 'Value', value);
},

/* Finds an option object by given value.
*************************************************************************/
_findItemByProperty: function (items, key, value) {
for (var i = 0; i < items.length; i++) {
if (items[i][key] == value) {
return items[i];
}
}

return {}; //no option found
return {}; //no item found
},

/* Gets text for a date field.
Expand All @@ -761,7 +781,44 @@

var displayFormat = field.displayFormat || this.options.defaultDateFormat;
var date = this._parseDate(fieldValue);
return $.datepicker.formatDate(displayFormat, date);
try {
return this._formatDate(displayFormat, date);
} catch (e) {
return date;
}
},

/* Format the date/time field.
*************************************************************************/
_formatDate: function (format, date) {

var pad = function (n, width, z) {
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
};

format = format.replace('ss', pad(date.getSeconds(), 2));
format = format.replace('s', date.getSeconds());
format = format.replace('dd', pad(date.getDate(), 2));
format = format.replace('d', date.getDate());
format = format.replace('mm', pad(date.getMinutes(), 2));
format = format.replace('m', date.getMinutes());
//format = format.replace('MMMM', monthNames[date.getMonth()]);
//format = format.replace('MMM', monthNames[date.getMonth()].substring(0, 3));
format = format.replace('MM', pad(date.getMonth() + 1, 2));
format = format.replace(/M(?![ao])/, date.getMonth() + 1);
//format = format.replace('DD', Days[date.getDay()]);
//format = format.replace(/D(?!e)/, Days[date.getDay()].substring(0, 3));
format = format.replace('yyyy', date.getFullYear());
format = format.replace('YYYY', date.getFullYear());
format = format.replace('yy', (date.getFullYear() + "").substring(2));
format = format.replace('YY', (date.getFullYear() + "").substring(2));
format = format.replace('HH', pad(date.getHours(), 2));
format = format.replace('H', date.getHours());
format = format.replace('hh', pad(date.getHours(), 2));
format = format.replace('h', date.getHours());
return format;
},

/* Gets options for a field according to user preferences.
Expand Down Expand Up @@ -926,29 +983,46 @@
* /Date(1320259705710)/
* 2011-01-01 20:32:42 (YYYY-MM-DD HH:MM:SS)
* 2011-01-01 (YYYY-MM-DD)
* 2011-10-15T14:42:51 (ISO 8601)
*************************************************************************/
_parseDate: function (dateString) {
if (dateString.indexOf('Date') >= 0) { //Format: /Date(1320259705710)/
return new Date(
parseInt(dateString.substr(6), 10)
);
} else if (dateString.length == 10) { //Format: 2011-01-01
return new Date(
parseInt(dateString.substr(0, 4), 10),
parseInt(dateString.substr(5, 2), 10) - 1,
parseInt(dateString.substr(8, 2), 10)
);
} else if (dateString.length == 19) { //Format: 2011-01-01 20:32:42
return new Date(
parseInt(dateString.substr(0, 4), 10),
parseInt(dateString.substr(5, 2), 10) - 1,
parseInt(dateString.substr(8, 2, 10)),
parseInt(dateString.substr(11, 2), 10),
parseInt(dateString.substr(14, 2), 10),
parseInt(dateString.substr(17, 2), 10)
);
} else {
this._logWarn('Given date is not properly formatted: ' + dateString);
try {
if (dateString.indexOf('Date') >= 0) { //Format: /Date(1320259705710)/
return new Date(
parseInt(dateString.substr(6), 10)
);
} else if (dateString.length == 10) { //Format: 2011-01-01
return new Date(
parseInt(dateString.substr(0, 4), 10),
parseInt(dateString.substr(5, 2), 10) - 1,
parseInt(dateString.substr(8, 2), 10)
);
} else if (dateString.length == 19) { //Format: 2011-01-01 20:32:42
return new Date(
parseInt(dateString.substr(0, 4), 10),
parseInt(dateString.substr(5, 2), 10) - 1,
parseInt(dateString.substr(8, 2), 10),
parseInt(dateString.substr(11, 2), 10),
parseInt(dateString.substr(14, 2), 10),
parseInt(dateString.substr(17, 2), 10)
);
} else if (dateString.indexOf('T') > 0) { //Format: ISO 8601 2009-10-15T14:42:51
var dtstr = dateString.replace(/\D/g, " ");
var dtcomps = dtstr.split(" ");
dtcomps[1]--; // modify month between 1 based ISO 8601 and zero based Date
return new Date(
Date.UTC(
dtcomps[0],
dtcomps[1],
dtcomps[2],
dtcomps[3],
dtcomps[4],
dtcomps[5]));
} else {
throw 'Given date is not properly formatted: ' + dateString;
}
} catch (e) {
this._logWarn(e);
return 'format error!';
}
},
Expand Down Expand Up @@ -1170,7 +1244,7 @@
jqXHR.abort();
return;
}

if (options.error) {
options.error(arguments);
}
Expand Down
2 changes: 1 addition & 1 deletion dev/jquery.jtable.creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
autoOpen: false,
show: self.options.dialogShowEffect,
hide: self.options.dialogHideEffect,
width: 'auto',
width: self.options.formDialogWidth ? self.options.formDialogWidth : 'auto',
minWidth: '300',
modal: true,
title: self.options.messages.addNewRecord,
Expand Down
1 change: 1 addition & 0 deletions dev/jquery.jtable.deletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
self._$deleteRecordDiv.dialog('close');
},
function (message) { //error
self._$deleteRecordDiv.dialog('close');
self._showError(message);
self._setEnabledOfDialogButton($deleteButton, true, self.options.messages.deleteText);
}
Expand Down
4 changes: 2 additions & 2 deletions dev/jquery.jtable.editing.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
autoOpen: false,
show: self.options.dialogShowEffect,
hide: self.options.dialogHideEffect,
width: 'auto',
width: self.options.formDialogWidth ? self.options.formDialogWidth : 'auto',
minWidth: '300',
modal: true,
title: self.options.messages.editRecord,
Expand Down Expand Up @@ -415,7 +415,7 @@
var $columns = $tableRow.find('td');
for (var i = 0; i < this._columnList.length; i++) {
var displayItem = this._getDisplayTextForRecordField(record, this._columnList[i]);
if ((displayItem != "") && (displayItem == 0)) displayItem = "0";
if ((displayItem === 0)) displayItem = "0";
$columns.eq(this._firstDataColumnOffset + i).html(displayItem || '');
}

Expand Down
29 changes: 20 additions & 9 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 @@ -129,11 +140,11 @@
/* Creates a standart textbox for a field.
*************************************************************************/
_createTextInputForField: function (field, fieldName, value) {
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
if (value != undefined) {
$input.val(value);
}

return $('<div />')
.addClass('jtable-input jtable-text-input')
.append($input);
Expand All @@ -142,11 +153,11 @@
/* Creates a password input for a field.
*************************************************************************/
_createPasswordInputForField: function (field, fieldName, value) {
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
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
2 changes: 1 addition & 1 deletion dev/jquery.jtable.header.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*

jTable 2.4.0
jTable 2.5.0
http://www.jtable.org

---------------------------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions dev/jquery.jtable.sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
_createHeaderCellForField: function (fieldName, field) {
var $headerCell = base._createHeaderCellForField.apply(this, arguments);
if (this.options.sorting && field.sorting) {
this._makeColumnSortable($headerCell, fieldName);
this._makeColumnSortable($headerCell, fieldName, field.initialSortingDirection);
}

return $headerCell;
Expand Down Expand Up @@ -104,7 +104,7 @@

/* Makes a column sortable.
*************************************************************************/
_makeColumnSortable: function ($columnHeader, fieldName) {
_makeColumnSortable: function ($columnHeader, fieldName, initialSortingDirection) {
var self = this;

$columnHeader
Expand All @@ -119,6 +119,10 @@
self._sortTableByColumn($columnHeader);
});

if(initialSortingDirection){
$columnHeader.addClass('jtable-column-header-sorted-' + initialSortingDirection.toLowerCase());
}

//Set default sorting
$.each(this._lastSorting, function (sortIndex, sortField) {
if (sortField.fieldName == fieldName) {
Expand Down
Loading