Dynamically changing element style/css

0
I want to create an element which style is dynamically changed based on entity attributes. This should allow for a fully dynamic style, so using an enumeration or classes won’t work. A simple use case would be to change buttons color to a hex value specified by the user in a text input field. I know this question has been asked before, but unfortunately this answer no longer works. What would be the best way to achieve this? Is there a way to make it work for advanced css selectors like :hover or ::after? What about keyframe animations? I would be very grateful for any help regarding this.
asked
3 answers
2

In MX Studio you can call a javascript action in a nanoflow. You will ofc need a user action or dataview to call the nanoflow.

https://docs.mendix.com/howto/extensibility/write-javascript-actions

https://appstore.home.mendix.com/link/app/109788/Mendix/JavaScript-Actions-How-To-Advanced

You can still use the mxui/dom client api to find and manipulate dom elements.

 

answered
1

For simple stuff you could use the css selector helper widget: https://appstore.home.mendix.com/link/app/35039/

This will help you set styling based on enums, booleans etc.

answered
0

Is this possible for Mendix native? Can I change the css of an app with the help of a javascript action? For example the font size on click of a button?

 

answered