Skip to content

Commit

Permalink
didn't pass in proper value to autocomplete renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethbruskiewicz committed Aug 21, 2024
1 parent 2cbaebe commit c4b4f82
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/editors/KeyValueEditor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Handsontable from 'handsontable';
import { MULTIVALUED_DELIMITER, titleOverText } from '@/lib/utils/fields';
import { isEmptyUnitVal } from '@/lib/utils/general';

// Derived from: https://jsfiddle.net/handsoncode/f0b41jug/

Expand Down Expand Up @@ -134,11 +135,11 @@ export const keyValueListRenderer = function (
cellProperties
) {
// Call the autocomplete renderer to ensure default styles and behavior are applied

const item = cellProperties.source.find(({ _id }) => _id === value);
Handsontable.renderers
.getRenderer('autocomplete')
.apply(this, [hot, TD, row, col, prop, item, cellProperties]);
.apply(this, [hot, TD, row, col, prop, value, cellProperties]);

const item = cellProperties.source.find(({ _id }) => _id === value);
if (item) {
// Use the label as the display value but keep the _id as the stored value
const label = item.label;
Expand All @@ -156,7 +157,7 @@ export const multiKeyValueListRenderer = (field) => {
.getRenderer('autocomplete')
.apply(this, [hot, TD, row, col, prop, value, cellProperties]);

if (!(value === null || value === '' || typeof value === 'undefined')) {
if (!(isEmptyUnitVal(value))) {
const label = value
.split(MULTIVALUED_DELIMITER)
.map((key) => titleOverText(merged_permissible_values[key]))
Expand Down

0 comments on commit c4b4f82

Please sign in to comment.