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

fix: Undefined value is getting shown for unmapped fields #443

Merged
merged 1 commit into from
Dec 22, 2023
Merged
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
9 changes: 5 additions & 4 deletions apps/widget/src/components/Common/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ Handsontable.renderers.registerRenderer(
TD.classList.add('custom-cell');
$(TD).tooltip('dispose');
const soureData = instance.getSourceDataAtRow(row) as IRecord;
const fieldValue = typeof soureData.record[name] === 'undefined' ? '' : soureData.record[name];

if (soureData.updated && soureData.updated[name]) {
if (soureData.errors && soureData.errors[name]) {
TD.innerHTML =
soureData.record[name] +
fieldValue +
`<svg xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle;float: right;cursor: pointer;color:#795e00;" viewBox="-2 -2 24 24" width="20" fill="currentColor">
<path d="M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-13a1 1 0 0 1 1 1v5a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1zm0 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"></path>
</svg>`;
} else {
TD.innerText = soureData.record[name];
TD.innerText = fieldValue;
$(TD).tooltip('dispose');
}
TD.style.backgroundColor = '#ffda5b';
Expand All @@ -77,7 +78,7 @@ Handsontable.renderers.registerRenderer(
}
if (soureData.errors && soureData.errors[name]) {
TD.innerHTML =
soureData.record[name] +
fieldValue +
`<svg xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle;float: right;cursor: pointer;color:#ff1111;" viewBox="-2 -2 24 24" width="20" fill="currentColor">
<path d="M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-13a1 1 0 0 1 1 1v5a1 1 0 0 1-2 0V6a1 1 0 0 1 1-1zm0 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"></path>
</svg>`;
Expand All @@ -93,7 +94,7 @@ Handsontable.renderers.registerRenderer(
return TD;
}

TD.innerText = soureData.record[name];
TD.innerText = fieldValue;

return TD;
}
Expand Down
Loading