konsoletyper / teavm-flavour

Framework for writing client-side applications using TeaVM
Apache License 2.0
110 stars 19 forks source link

Issue using bidir-value on a <select> when <option>s are added dynamically #54

Open PokingUrsa opened 4 years ago

PokingUrsa commented 4 years ago

We recently encountered an issue with Flavour when trying to specify a 'select' element with dynamically-generated options:

<select html:bidir-value="selectedValue">
  <std:foreach var="item" in="items">
    <option attr:value="item.value"><html:text value="item.description"></option>
  </std:foreach>
</select>

The tricky part is that "items" is being loaded from the server, and isn't available during the first template update.

What happens is:

Is there a clean solution to this?

cyberquarks commented 3 years ago

@PokingUrsa have you tried std:if condition?

Not sure if all EL is documented by I just usually use sourcegraph to find some examples from the repo: https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/konsoletyper/teavm-flavour%24+std:if&patternType=literal