Stringify objects on dashboard to avoid [Object object]

This commit is contained in:
cvermand 2021-08-26 19:12:30 +02:00 committed by Tamo
parent ea2f2ecf96
commit 4fd0116a0d
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -60,7 +60,13 @@ $('#query, #filters').on('input', function () {
const content = document.createElement('div');
content.classList.add("content");
content.innerHTML = element[prop];
// Stringify Objects and Arrays to avoid [Object object]
if (typeof element[prop] === 'object' && element[prop] !== null) {
content.innerHTML = JSON.stringify(element[prop]);
} else {
content.innerHTML = element[prop];
}
field.appendChild(attribute);
field.appendChild(content);