-
|
I have an existing laravel component I want to add Alpine so I can react based on the value of that dropdown. This works fine: However if I update the value in alpine programatically, the value displayed in the select box doesn't change, as TomSelect will only update it's own selected value on receiving a change Dom Event. So for example, if I programatically update the value like, the alpine state updates, but the select box shows the wrong value: I can fix this, by triggering the dom event manually: This seems to work, but is there a cleaner solution to this? I thought about overriding the value setter via The other option is an ugly interval, but that's got performance problem written all over it: Any other ideas on this? TLDR; What options are there for 3-way data binding, where the input state needs to be in sync between Alpine, DOM and a 3rd Party Lib? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Ideally, the custom element that is implementing the Select should be checking for changes to it's own So it could be worth discussing it there with reducing out Alpine entirely and changing it to just doing |
Beta Was this translation helpful? Give feedback.
Ideally, the custom element that is implementing the Select should be checking for changes to it's own
valueso that it would behave more like a real element.So it could be worth discussing it there with reducing out Alpine entirely and changing it to just doing
element.value =. It is a situation it should be able to handle.