pull/4142/head
mertsincan 2023-09-05 03:12:01 +01:00
parent 86350195b5
commit 3293ef980c
1 changed files with 12 additions and 7 deletions

View File

@ -56,16 +56,21 @@ export default {
}, },
resolveFieldData(data, field) { resolveFieldData(data, field) {
if (!data || !field) {
// short circuit if there is nothing to resolve
return null;
}
try { try {
const value = data[field]; const value = data[field];
if (value)
return value; if (this.isNotEmpty(value)) return value;
} } catch {
catch { // Performance optimization: https://github.com/primefaces/primereact/issues/4797
// do nothing and continue to other methods to resolve field data // do nothing and continue to other methods to resolve field data
} }
if (data && Object.keys(data).length && field) { if (Object.keys(data).length) {
if (this.isFunction(field)) { if (this.isFunction(field)) {
return field(data); return field(data);
} else if (field.indexOf('.') === -1) { } else if (field.indexOf('.') === -1) {
@ -84,9 +89,9 @@ export default {
return value; return value;
} }
} else {
return null;
} }
return null;
}, },
getItemValue(obj, ...params) { getItemValue(obj, ...params) {