Skip to content

Commit f31e2f7

Browse files
committed
Increment version to 2.5.0
1 parent 6b93b64 commit f31e2f7

File tree

7 files changed

+45
-151
lines changed

7 files changed

+45
-151
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": [
44
"lib/jquery.jtable.min.js"
55
],
6-
"version": "2.4.1",
6+
"version": "2.5.0",
77
"authors": [
88
"Halil ibrahim Kalkan <[email protected]>"
99
],

dev/jquery.jtable.header.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22

3-
jTable 2.4.0
3+
jTable 2.5.0
44
http://www.jtable.org
55

66
---------------------------------------------------------------------------

jTable.jquery.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"paging",
1212
"sorting"
1313
],
14-
"version": "2.4.1",
14+
"version": "2.5.0",
1515
"author": {
1616
"name": "Halil ibrahim Kalkan",
1717
"email": "[email protected]",
@@ -20,7 +20,7 @@
2020
"maintainers": [
2121
{
2222
"name": "Halil ibrahim Kalkan",
23-
"email": "[email protected]",
23+
"email": "[email protected]",
2424
"url": "http://www.halilibrahimkalkan.com"
2525
}
2626
],

jquery.jtable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
jTable 2.4.0
3+
jTable 2.5.0
44
http://www.jtable.org
55
66
---------------------------------------------------------------------------

lib/jquery.jtable.js

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
jTable 2.4.0
3+
jTable 2.5.0
44
http://www.jtable.org
55
66
---------------------------------------------------------------------------
@@ -124,6 +124,8 @@ THE SOFTWARE.
124124

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

127+
_extraFieldTypes:[],
128+
127129
/************************************************************************
128130
* CONSTRUCTOR AND INITIALIZATION METHODS *
129131
*************************************************************************/
@@ -167,6 +169,9 @@ THE SOFTWARE.
167169
if (props.inputClass == undefined) {
168170
props.inputClass = '';
169171
}
172+
if (props.placeholder == undefined) {
173+
props.placeholder = '';
174+
}
170175

171176
//Convert dependsOn to array if it's a comma seperated lists
172177
if (props.dependsOn && $.type(props.dependsOn) === 'string') {
@@ -186,6 +191,7 @@ THE SOFTWARE.
186191
this._columnList = [];
187192
this._fieldList = [];
188193
this._cache = [];
194+
this._extraFieldTypes = [];
189195
},
190196

191197
/* Fills _fieldList, _columnList arrays and sets _keyField variable.
@@ -737,7 +743,11 @@ THE SOFTWARE.
737743
return field.display({ record: record });
738744
}
739745

740-
if (field.type == 'date') {
746+
var extraFieldType = this._findItemByProperty(this._extraFieldTypes, 'type', field.type);
747+
if(extraFieldType && extraFieldType.creator){
748+
return extraFieldType.creator(record, field);
749+
}
750+
else if (field.type == 'date') {
741751
return this._getDisplayTextForDateRecordField(field, fieldValue);
742752
} else if (field.type == 'checkbox') {
743753
return this._getCheckBoxTextForFieldByValue(fieldName, fieldValue);
@@ -772,13 +782,19 @@ THE SOFTWARE.
772782
/* Finds an option object by given value.
773783
*************************************************************************/
774784
_findOptionByValue: function (options, value) {
775-
for (var i = 0; i < options.length; i++) {
776-
if (options[i].Value == value) {
777-
return options[i];
785+
return this._findItemByProperty(options, 'Value', value);
786+
},
787+
788+
/* Finds an option object by given value.
789+
*************************************************************************/
790+
_findItemByProperty: function (items, key, value) {
791+
for (var i = 0; i < items.length; i++) {
792+
if (items[i][key] == value) {
793+
return items[i];
778794
}
779795
}
780796

781-
return {}; //no option found
797+
return {}; //no item found
782798
},
783799

784800
/* Gets text for a date field.
@@ -1608,7 +1624,7 @@ THE SOFTWARE.
16081624
/* Creates a standart textbox for a field.
16091625
*************************************************************************/
16101626
_createTextInputForField: function (field, fieldName, value) {
1611-
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
1627+
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="text" name="' + fieldName + '"></input>');
16121628
if (value != undefined) {
16131629
$input.val(value);
16141630
}
@@ -1621,7 +1637,7 @@ THE SOFTWARE.
16211637
/* Creates a password input for a field.
16221638
*************************************************************************/
16231639
_createPasswordInputForField: function (field, fieldName, value) {
1624-
var $input = $('<input class="' + field.inputClass + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
1640+
var $input = $('<input class="' + field.inputClass + '" placeholder="' + field.placeholder + '" id="Edit-' + fieldName + '" type="password" name="' + fieldName + '"></input>');
16251641
if (value != undefined) {
16261642
$input.val(value);
16271643
}
@@ -2729,7 +2745,7 @@ THE SOFTWARE.
27292745
var $columns = $tableRow.find('td');
27302746
for (var i = 0; i < this._columnList.length; i++) {
27312747
var displayItem = this._getDisplayTextForRecordField(record, this._columnList[i]);
2732-
if ((displayItem != "") && (displayItem == 0)) displayItem = "0";
2748+
if ((displayItem === 0)) displayItem = "0";
27332749
$columns.eq(this._firstDataColumnOffset + i).html(displayItem || '');
27342750
}
27352751

@@ -4240,7 +4256,7 @@ THE SOFTWARE.
42404256
_createHeaderCellForField: function (fieldName, field) {
42414257
var $headerCell = base._createHeaderCellForField.apply(this, arguments);
42424258
if (this.options.sorting && field.sorting) {
4243-
this._makeColumnSortable($headerCell, fieldName);
4259+
this._makeColumnSortable($headerCell, fieldName, field.initialSortingDirection);
42444260
}
42454261

42464262
return $headerCell;
@@ -4287,7 +4303,7 @@ THE SOFTWARE.
42874303

42884304
/* Makes a column sortable.
42894305
*************************************************************************/
4290-
_makeColumnSortable: function ($columnHeader, fieldName) {
4306+
_makeColumnSortable: function ($columnHeader, fieldName, initialSortingDirection) {
42914307
var self = this;
42924308

42934309
$columnHeader
@@ -4302,6 +4318,10 @@ THE SOFTWARE.
43024318
self._sortTableByColumn($columnHeader);
43034319
});
43044320

4321+
if(initialSortingDirection){
4322+
$columnHeader.addClass('jtable-column-header-sorted-' + initialSortingDirection.toLowerCase());
4323+
}
4324+
43054325
//Set default sorting
43064326
$.each(this._lastSorting, function (sortIndex, sortField) {
43074327
if (sortField.fieldName == fieldName) {

0 commit comments

Comments
 (0)