How to initiate a multiple select in custom todo widget
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 12:49 AM
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:
- Load the select with options selected as I can in all other types of inputs I am using
- 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:
- How to initiate the value of a select with property 'multiple'?
- Is there any other way to let the user select multiple options of something (too many options for checkboxes).
0 REPLIES 0