Show page Buttons change color after beeing clicked.

0
Hi everyone, I have an overview page in my Mendix application that contains several buttons. Each button navigates to a different page that displays objects from the same entity. I want to implement a feature where, after a user clicks a button and views the corresponding page, the button changes color (e.g., turns gray) to indicate that it has been used or visited. Could someone guide me on how to achieve this in Mendix? Any tips on managing the state of the buttons or any specific microflows or expressions that could be used would be greatly appreciated. Thanks in advance for your help!
asked
1 answers
0

Ewan,

You could accomplish this by

  • creating an entity you use on your page.  A non persistent entity would be best. 
  • On this entity, have a boolean attribute for each of the pages users are able to view.  For instance, Page1Viewed, Page2Viewed, etc.  These attributes would have a default value of false. 
  • Each page button would call a nanoflow that ou create.  These nanoflows, one for each button, should mark the boolean as true and open the respective page. 
  • Finally, on each button, on the Appearance tab, use the Dynamic Classes option.  You would use a different class depending on the value of the boolean attribute.  The expression you would enter here would look something like 
    if $currentObject/Page1Viewed
    then
      'clicked-class'
    else
      'unclicked-class'
      
  • you could use out of the box classes (like btn-default, btn-success, etc.) or create your own in your app styling files (these can be found in the Project Explorer in Studio Pro.  Open the App node and expand the Styling section)

Hope that helps,

Mike

answered