Conditional button caption - Mendix Forum

Conditional button caption


Right now I often find myself in a situation where I have an edit button on a datagrid that is actually a(n) edit and/or view button depending on what user is logged in. For example an User only has read rights (View) while an admin has edit rights (Edit). I think it is not considered best practice to show a 'Edit' button to a user when he does not have edit rights on that page.

This leaves me with two options:

  1. Create a separate 'view' button that leads to the same page. The disadvantage of this option is that I can only have one default button on the datagrid so users will have to click on the view button instead of just double clicking the entity in the grid;
  2. Change the name of the 'edit' button to 'details' making it sound more generic for admins and users alike. This however would mean that you would have to change every edit button to this details button and for best practice purposes also change every page title.

The best solution in my eyes would be to have the possibility to set a default button for a grid based on the user role. That way you can have a 'edit' button and 'view' button each with their own 'override page title'-value plus conditional visibility while still having the benefit of the is default button option.

0 answers