Nuxeo Server

How to Control the Display Mode of a Widget

This page is scheduled for review and update. Check back soon for updated content!

It is a very frequent requirement to be able to control the display mode of a widget depending on some conditions such as the lifecycle state of the document, or the groups a user belongs to. Nuxeo Studio enables you to leverage the power of the Nuxeo Layout service and to implement your requirements using an expression when you configure your widget.

For instance, when you are editing a document layout, whether it is the creation, edition or view layout, if you edit the widgets you dropped on the layout, you will see the "Advanced mode configuration" section.

Make sure that the Nuxeo JSF UI target package is checked in your project's Application Definition to get all the needed features in Nuxeo Studio.

  1. Unfold the option by clicking on the black arrow,
  2. Fill the text area with an expression that will control the display of your widget. Here are some samples:
  • #{layoutValue.currentLifeCycleState =='approved' && currentUser.model.user.company == 'Nuxeo'?'edit':'hidden'} This expression says that the field will be invisible unless the document is in state "approved" and the company of the user is "Nuxeo". In that case it will be editable.
  • #{currentUser.isMemberOf('quality_managers') && (layoutValue.dc.nature=='procedure'||layoutValue.dc.nature=='decree')?'edit':'view'} This expression says that the field will be editable only for people from group quality_managers and only if the document is a decree or a procedure. Otherwise, value is just viewable.
  • #{nxd:hasPermission(layoutValue, 'Editorial')?'edit':'view'} This expression says that the widget will be editable only for users having the Editorial permission.

You can also see the reference documentation on layouts, more specifically the EL expressions in layouts and widgets section.


4 days ago Loubna Benzaama Flag Studio relates pages on master
2 months ago Loubna Benzaama Fix Showcase Content add-on doc
3 years ago Manon Lumeau 28
3 years ago Manon Lumeau 27
4 years ago Solen Guitter 26
4 years ago Manon Lumeau 25
4 years ago Manon Lumeau 24
4 years ago Manon Lumeau 23
4 years ago Manon Lumeau 22
4 years ago Manon Lumeau 20
4 years ago Manon Lumeau 21
4 years ago Manon Lumeau 19
4 years ago Solen Guitter 18
4 years ago Manon Lumeau 17
4 years ago Manon Lumeau 16
5 years ago Solen Guitter 15
5 years ago Solen Guitter 14
5 years ago Solen Guitter 13 | Added related EL topics
7 years ago Solen Guitter 11
7 years ago Solen Guitter 12 | Migrated to Confluence 4.0
7 years ago Solen Guitter 10
8 years ago Solen Guitter 9 | formatting and typos
8 years ago Alain Escaffre 8
8 years ago Alain Escaffre 7
8 years ago Alain Escaffre 6
8 years ago Alain Escaffre 5
8 years ago Alain Escaffre 3
8 years ago Alain Escaffre 4
8 years ago Alain Escaffre 2
8 years ago Alain Escaffre 1
History: Created by Alain Escaffre

We'd love to hear your thoughts!

All fields required