Bl-multiple-select custom component dynamic value

Hey @dima or other members of the backendless team.

I am trying to use the custom multiselect component from the marketplace. I need to dynamically load the option set and have followed the same procedure for dynamic loading in a normal select component as outlined here. I am getting an error that the component expects a list of options but it gets an undefined type. I see in the documentation that it wants the format “Options: [{label: String , value: String }]” but it actually seems like that’s what is passed in Mark’s example.


I do have the “Set Options to Multiselect” block in the On Mounted event handler of a Block but I don’t think that is the cause here.

Can you help me identify where I’ve gone wrong?

Interestingly, I just realized it actually is populating the values into the drop down. It’s just throwing a ton of errors.

Roughly 70 of these: index.js:1 The “Multiple Select” component expects a list of options but it gets an undefined type. Make sure you passed the correct one in Logic or the component Settings.

Hi.
Our UI team will look into it today and post here the result.
Thanks for your patience.

Hello @James_Hereford

Could you set these records somewhere in PageData, and use Options Logic handler from multiple select?

I think it could be related to rendering order(element is not shown for a moment while you setting options), but not sure where it happens because there is a lot of elements.

Also, if there are about of 70 errors, that could mean that:
a) you trying to set options 70 times
b) component rerendered 70 times.

To avoid similar issues I could advise the next article:
https://backendless.com/docs/uibuilder/ui_rendering.html

As for “undefined” type - that also could mean that you passed the wrong options(or did not even pass). Did you check what you get with logs?

Thanks Dima. Based on your advice I moved the load objects and map items in list transformation over into the On Before Mounted event for the form and stored it to a property. I then loaded the property in the Options logic and it appears to work. I’ll let you know if I have any more issues.

Eventually I did actually try calling the ‘set items in multiselect’ function in the On Visibility Change handler for the element itself. I thought that could avoid any rendering order issues since it’s literally in the block itself. It still didn’t work though. Should I assume that I simply can’t use that ‘set items’ block in any selector with conditional visibility?

In general it is possible, but it requires following some rules like - not applying properties for elements which not already on the scene. And in your case, I’m not sure if everything is correct. So you could simply use this kind of async logic, where your element will get needed options only at the moment when appears on the screen.

Sounds good. Thanks!