I'm using REST API as a datasource and not sure how to manually set a value in the MultiSelect widget
The widget datasource is named Service
and has an id
and name
What I tried is widget.values = [...IDs of the values...]
but it doesn't work
Two things:
@datasources.Services.items
-- won't work for a multiselect, because it represents the entire set of records in your Services datasource. The binding that Markus suggests is what projects to grab just the names of each of the items. If you are trying to present the name
as the human-readable choice but use the id
as the value you're going to do something with, then you'll want this:widget.names = @datasources.Service.items..name;
widget.options = @datasources.Service.items..id;
@datasources.User.item.Services#strToArray()
; orwidget.values = [selection1, selection5, selection6];