Skip to content

Commit

Permalink
Merge pull request #2038 from ismcagdas/master
Browse files Browse the repository at this point in the history
Implemented dropdown actions using bootstrap and tether
  • Loading branch information
hikalkan authored Mar 29, 2017
2 parents 8028579 + 4609152 commit bcd862d
Show file tree
Hide file tree
Showing 4 changed files with 5,203 additions and 6 deletions.
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
23 changes: 18 additions & 5 deletions dev/jquery.jtable.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@

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

_extraFieldTypes:[],

/************************************************************************
* CONSTRUCTOR AND INITIALIZATION METHODS *
*************************************************************************/
Expand Down Expand Up @@ -160,6 +162,7 @@
this._columnList = [];
this._fieldList = [];
this._cache = [];
this._extraFieldTypes = [];
},

/* Fills _fieldList, _columnList arrays and sets _keyField variable.
Expand Down Expand Up @@ -711,7 +714,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 @@ -746,13 +753,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 Down
Loading

0 comments on commit bcd862d

Please sign in to comment.