Open bh213 opened 2 years ago
Yes you can add and remove components dynamically. All you need it to call style.sync() in your update loop.
Le sam. 29 janv. 2022 à 10:41, Gorazd Breskvar @.***> a écrit :
Can domkit components be dynamically added or removed to the scene, e.g. as a result of button click and have CSS properly applied?
I also noticed that :first-child & :last-child don't work with such dynamically added components (=outside component constructor) ..
I'd like to add proper example of how to add and remove components if there exists an "official way". Thanks.
See https://github.com/bh213/heaps-domkit-sample
— Reply to this email directly, view it on GitHub https://github.com/HeapsIO/domkit/issues/36, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQHKFTYYINYQQLBPOF3UYOY3BANCNFSM5NCV3NXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
I think I got everything working correctly (even adding subtrees of components) but :odd and :even don't seem to update correctly when I remove e.g. first component from the list of the children.
Example here: https://bh213.github.io/heaps-domkit-sample/ -page 6, just click remove button
Oh i think indeed these cases are not handled ! Atm :odd/:even won't react dynamically. That's indeed a bug, but not easy to fix at all.
Le dim. 30 janv. 2022 à 19:43, Gorazd Breskvar @.***> a écrit :
I think I got everything working correctly (even adding subtrees of components) but :odd and :even don't seem to update correctly when I remove e.g. first component from the list of the children.
Example here: https://bh213.github.io/heaps-domkit-sample/ -page 6, just click remove button
— Reply to this email directly, view it on GitHub https://github.com/HeapsIO/domkit/issues/36#issuecomment-1025204162, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQBPZ4NPEN6XKXA66HDUYWBDXANCNFSM5NCV3NXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
Can domkit components be dynamically added or removed to the scene, e.g. as a result of button click and have CSS properly applied?
I also noticed that :first-child & :last-child don't work with such dynamically added components (=outside component constructor) ..
I'd like to add proper example of how to add and remove components if there exists an "official way". Thanks.
See https://github.com/bh213/heaps-domkit-sample