gsilber / WebEZ

0 stars 1 forks source link

Creating Dynamic Dropdowns #18

Open acbart opened 7 months ago

acbart commented 7 months ago

What's the "correct" way to create a dynamic dropdown in WebEZ? I know I cannot just bind an array to a select (although perhaps @clause 's new code will allow that). I had thought I would create a component that just has <option> inside, but that doesn't work because of all the div stuff surrounding any given component - it doesn't become a valid select box.

I can't find any way to inject arbitrary HTML at runtime, so I can't even hack in something like this.insertHTML(, "options"). Is there some other strategy I haven't thought of for making this work? Or should I be trying to build a BindOptionsToStrings decorator based on the example from before?

gsilber commented 7 months ago

The only way currently is to generate the html text for the select explicitly and bind it to a container.

@BindValue(“somediv”)

Text:string=””;

Then

this.Text=”

From: Austin Cory Bart @.> Sent: Sunday, April 14, 2024 12:27 PM To: gsilber/WebEZ @.> Cc: Subscribed @.***> Subject: [gsilber/WebEZ] Creating Dynamic Dropdowns (Issue #18)

What's the "correct" way to create a dynamic dropdown in WebEZ? I know I cannot just bind an array to a select (although perhaps @clause https://github.com/clause 's new code will allow that). I had thought I would create a component that just has

I can't find any way to inject arbitrary HTML at runtime, so I can't even hack in something like this.insertHTML(${value}, "options"). Is there some other strategy I haven't thought of for making this work? Or should I be trying to build a BindOptionsToStrings decorator based on the example from before?

— Reply to this email directly, view it on GitHub https://github.com/gsilber/WebEZ/issues/18 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVF3IDYUBO7GBKWVSM6NK3Y5KU4HAVCNFSM6AAAAABGGHXKB2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DEMRUGYYTCOA . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/AHVF3IFA2FYCLXJFOLTDGGTY5KU4HA5CNFSM6AAAAABGGHXKB2WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHILJPV4Y.gif Message ID: @. @.> >