开发者

How to hide RichFaces component on load?

开发者 https://www.devze.com 2022-12-21 06:08 出处:网络
I would like to hide selected rendered component (for example: label) on page load. This gives mi opportunity to subsequently show component after user action (for example: when user clicks link).

I would like to hide selected rendered component (for example: label) on page load. This gives mi opportunity to subsequently show component after user action (for example: when user clicks link).

Here is example:

<a4j:outputPanel id="myPanel">
    <h:outputText value="Text 1" />
    <h:outputText value="Text 2" />
</a4j:outputPanel>
<a4j:commandLink ajaxSingle="true" onclick="#{rich:component('myPanel')}.show()">
    <h:outputText value="Show panel"/>
</a4j:commandLink>

Panel myPanel should be hidden at the begining (after page load) and should apper when user clicks link.

Can you give me ple开发者_如何学Goase advice how to do that?

Thanks, Rafal


Here is solution from RichFaces forum which works fine.

CSS:

.hideOnLoad {
    display: none;
}

Page fragment:

<a4j:outputPanel id="myMessage" styleClass="hideOnLoad">
    <h:outputText value="This is my first message" />
    <h:outputText value="This is my second message" />
</a4j:outputPanel>
<br/>
<a4j:commandLink ajaxSingle="true"
    onclick="$('myMessage').removeClassName('hideOnLoad');"
    value="Show my message" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号