Fixed #457 - Allow custom display callbacks in resolving fields

pull/642/head
Cagatay Civici 2020-09-08 15:16:20 +03:00
parent 74c5461388
commit 4b3734fc02
1 changed files with 19 additions and 13 deletions

View File

@ -58,23 +58,29 @@ export default class ObjectUtils {
}
static resolveFieldData(data, field) {
if (data && field) {
if (field.indexOf('.') === -1) {
return data[field];
}
else {
let fields = field.split('.');
let value = data;
for (var i = 0, len = fields.length; i < len; ++i) {
value = value[fields[i]];
}
return value;
}
if (typeof field === 'function') {
return field(data);
}
else {
return null;
if (data && field) {
if (field.indexOf('.') === -1) {
return data[field];
}
else {
let fields = field.split('.');
let value = data;
for (var i = 0, len = fields.length; i < len; ++i) {
value = value[fields[i]];
}
return value;
}
}
else {
return null;
}
}
}
static filter(value, fields, filterValue) {
var filteredItems = [];