Skip to content

Commit

Permalink
Fix #673
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrancart committed Nov 24, 2024
1 parent 5f383b2 commit a685b13
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/sparnatural/components/widgets/ListWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export class ListWidget extends AbstractWidget {

if (items.length > 0) {

this.selectHtml.append(
$("<option value=''>" + I18n.labels.ListWidgetSelectValue + "</option>")
);

// find distinct values of the 'group' binding
const groups = [...new Set(items.map(item => item.group))];

Expand Down Expand Up @@ -116,9 +120,13 @@ export class ListWidget extends AbstractWidget {
if (option.length > 1)
throw Error("List widget should allow only for one el to be selected!");

let itemLabel = option[0].getAttribute("data-itemLabel");
let listWidgetValue: WidgetValue = this.buildValue(option[0].value, itemLabel);
this.renderWidgetVal(listWidgetValue);
// this is the placeholder
if(option[0].value == "")
return;

let itemLabel = option[0].getAttribute("data-itemLabel");
let listWidgetValue: WidgetValue = this.buildValue(option[0].value, itemLabel);
this.renderWidgetVal(listWidgetValue);
});

} else {
Expand Down

0 comments on commit a685b13

Please sign in to comment.