Sunday, May 22, 2011

Hide When in XPages

To hide an Xpage Controlsbased on a  formula.

Under the All properties of the Control,We have Rendered and Loaded property. Using either one of these properties we can  hide or display the component.

<xp:button value="Label" id="button1">
        <xp:this.rendered><![CDATA[#{javascript:context.getUser().getRoles().contains('[Configuration]')}]]></xp:this.rendered>
    </xp:button>

In this case, only if the role "Configuration" is enabled for the current user, then this button will be visible.

When we use the "Rendered" property, the Control will be generated by the server but it will  not be displayed.  However if we use Loaded, the Control will not be generated by the  server

No comments:

Post a Comment