Skip to content

Commit

Permalink
Increment version to 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hikalkan committed Mar 30, 2017
1 parent 6b93b64 commit f31e2f7
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 151 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"main": [
"lib/jquery.jtable.min.js"
],
"version": "2.4.1",
"version": "2.5.0",
"authors": [
"Halil ibrahim Kalkan <[email protected]>"
],
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
4 changes: 2 additions & 2 deletions jTable.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"paging",
"sorting"
],
"version": "2.4.1",
"version": "2.5.0",
"author": {
"name": "Halil ibrahim Kalkan",
"email": "[email protected]",
Expand All @@ -20,7 +20,7 @@
"maintainers": [
{
"name": "Halil ibrahim Kalkan",
"email": "[email protected]",
"email": "[email protected]",
"url": "http://www.halilibrahimkalkan.com"
}
],
Expand Down
2 changes: 1 addition & 1 deletion jquery.jtable.js
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
42 changes: 31 additions & 11 deletions lib/jquery.jtable.js
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 Expand Up @@ -124,6 +124,8 @@ THE SOFTWARE.

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

_extraFieldTypes:[],

/************************************************************************
* CONSTRUCTOR AND INITIALIZATION METHODS *
*************************************************************************/
Expand Down Expand Up @@ -167,6 +169,9 @@ THE SOFTWARE.
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 @@ -186,6 +191,7 @@ THE SOFTWARE.
this._columnList = [];
this._fieldList = [];
this._cache = [];
this._extraFieldTypes = [];
},

/* Fills _fieldList, _columnList arrays and sets _keyField variable.
Expand Down Expand Up @@ -737,7 +743,11 @@ THE SOFTWARE.
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 @@ -772,13 +782,19 @@ THE SOFTWARE.
/* 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 Down Expand Up @@ -1608,7 +1624,7 @@ THE SOFTWARE.
/* 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);
}
Expand All @@ -1621,7 +1637,7 @@ THE SOFTWARE.
/* 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);
}
Expand Down Expand Up @@ -2729,7 +2745,7 @@ THE SOFTWARE.
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 Expand Up @@ -4240,7 +4256,7 @@ THE SOFTWARE.
_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 @@ -4287,7 +4303,7 @@ THE SOFTWARE.

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

$columnHeader
Expand All @@ -4302,6 +4318,10 @@ THE SOFTWARE.
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

0 comments on commit f31e2f7

Please sign in to comment.