Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Dynamically created options in repeated sections

May 12 (1 year ago)
Ulti
Pro
Sheet Author
API Scripter

Does any of you knows if there is a way to use dynamically created options insied repeating sections? It seems that when the sheetworker calls populateListOptions, then all the attributes populated by that call are reset with the option marked as selected in the option array. As a workaround, when there is only one attribute, I read it and set selected option to be the same as the attribute (maybe that shouldn't be necessary to start with?). But when the attribute is in a repeating section, then there is more than one with the same list, and all of them seem to be reset to the same value. If there is no element marked as selected, it seems that the first element of the array is considered selected. So, as soon as I close the sheet and open it again, all values are reset. Is there a trick to have one list per repeated attribute,oram I doing something wrong?

May 12 (1 year ago)
vÍnce
Pro
Sheet Author

Hi Laurent,

I didn't even know we could create a dynamic list of options within a select... Lol. Do you have reference/example you could link to? I've always created multiple hidden selects, each containing specific options, only revealing the one select as-needed using css and sheetworkers. A process that can be a little clunky for sure.

May 12 (1 year ago)
Ulti
Pro
Sheet Author
API Scripter

Here is the reference. It should be much easier than meddling with css, but doesn't work exactly as promised.

May 12 (1 year ago)
vÍnce
Pro
Sheet Author

Now I understand why I forgot about this;

vÍnce said:
Glad to see this added and I'll be following this thread... but it seems like the implementation is "half-baked", similar to the jQuery addition added last year.

I bet Scott knows the answers/limitations of this.

May 12 (1 year ago)
GiGs
Pro
Sheet Author
API Scripter


vÍnce said:

I've always created multiple hidden selects, each containing specific options, only revealing the one select as-needed using css and sheetworkers. A process that can be a little clunky for sure.

That's the method I use. IIRC the populateListOptions has some issues that havent been fixed. But it will be great if its fixed.

May 12 (1 year ago)

Edited May 12 (1 year ago)
vÍnce
Pro
Sheet Author

Fingers crossed that many of these lingering "shortcomings" will be easily handled with the forthcoming Beacon sheet development system.  And of course, Beacon will probably have it's share of pitfalls as well... LOL