force the update of x-for template #2521
Replies: 7 comments 4 replies
-
There's no official way to refresh a directive. The easiest way is to reassign options after you change the select property. Something like: |
Beta Was this translation helpful? Give feedback.
-
Regarding x-if + x-for, if you add x-if to the main tag, the whole loop will be effected so the other option would be ambiguous |
Beta Was this translation helpful? Give feedback.
-
for some unknow reason, i try to do a codepen, but i don't find how to integrate alpinejs to the javascript side: |
Beta Was this translation helpful? Give feedback.
-
Here is what i have ended with: https://tailwindcomponents.com/component/alpinejs-multiple-select-dropdown-with-tags-filter |
Beta Was this translation helpful? Give feedback.
-
I was too stumbling on this and came up with this solution |
Beta Was this translation helpful? Give feedback.
-
but...why would you want to? |
Beta Was this translation helpful? Give feedback.
-
Ah, so it's an issue of x-sort with x-for. They are not compatible until my long open x-for refactor is merged... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
through a function i change the the attribute of a select option element to "selected"
but as the numbers of options in the collection doesn't change, i was wondering of to force its refreshng ?
P.S.: also, this should be better in another topic, but this would be great if we could cumulate x-for & x-if in the same element
Beta Was this translation helpful? Give feedback.
All reactions