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

Implemented dropdown actions using bootstrap and tether #2038

Merged
merged 7 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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