How to initiate a multiple select in custom todo widget

Niklas6
Tera Expert

We need to let the user select multiple options from a list in a custom todo widget. This is how I add the control: 

 

<select id="u_applicable_checklist" class="dropdown form-control" ng-model="c.data.u_applicable_checklist" multiple>
      <option ng-repeat="opt in c.data.checklistOptions" value="{{opt.value}}">{{opt.label}}</option>
</select>

 

The control is presented properly with all options in the list. So far so good. 

 

If I select some options in the portal and click save, the options are saved to the task. The problem is that I cannot:

 

  1. Load the select with options selected as I can in all other types of inputs I am using
  2. Even if I managed to mark the option tag as 'selected' the selected rows are not marked as selected and when saving the selected options are not actually saved (i.e. if I hard code all options to be selected but I don't actively select any in the portal). 

 

I have tried things like

  • forEach on the array of saved options and tried to set the property 'selected' to true, nothing happens. 
  • Set the value as comma separated list
  • Set the value as array
  • Tried the normal ng-model approach
  • And of course hard code the options to be selected just for debugging purpose

 

So the questions boils down to these:

  1. How to initiate the value of a select with property 'multiple'?
  2. Is there any other way to let the user select multiple options of something (too many options for checkboxes). 

 

0 REPLIES 0