Solved

How to make a p:commadLink visible/invisible?

Posted on 2014-03-26
4
612 Views
Last Modified: 2014-03-27
At the start of a page I have a p:commandLink that MUST be made invisible. Then on the same page, at a button press I do some processing on the server side in a bean. If the calculations allow, I am supposed to "Make the p:commandLink" visible to the user. What are the properties I need to set at the start on the commandLink to make it invivible and then toggle it on the Server Side to make it visible?

Here is the part of that jsf code.
the cmdLinkRewActions is the commandLink that I want to make invisible at the start and them when the cmdLinkActions is clicked the cmdLinkRewActions is made visible based on a calculation in services.makeVisibleActions().

So how and what properties of cmdLinkRewActions  I have to handle. I have seen the p:commandLink properties on Prime Faces Show Case but did not do any good to me.

<table>
  <tr>
     <td colspan="2">
      <p:commandLink id="cmdLinkActions" value="Actions"
         actionListener="#{services.makeVisibleActions()}" />
      <br />
    </td>
 </tr>
 <tr>
     <td colspan="2">
      <p:commandLink  id="cmdLinkRewActions" value="Review Actions"      
       actionListener="#{services.goToReviewActions ()}" />
  <br />
 </td>
</tr>
0
Comment
Question by:prain
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 39958283
Use the "rendered" attribute

<p:commandLink id="cmdLinkActions" value="Actions" rendered="true"
         actionListener="#{services.makeVisibleActions()}" />

Open in new window


and set it to false in order to hide the commandLink.
0
 

Author Comment

by:prain
ID: 39958592
Sorry it did not work. At the start, I want cmdLinkRewActions to be invisible. So I typed

<table>
  <tr>
     <td colspan="2">
      <p:commandLink id="cmdLinkActions" value="Actions"
         actionListener="#{services.makeVisibleActions()}" />
      <br />
    </td>
 </tr>
 <tr>
     <td colspan="2">
      <p:commandLink  id="cmdLinkRewActions" value="Review Actions"     rendered="false"
       actionListener="#{services.goToReviewActions ()}" />
  <br />
 </td>
</tr>



I expected NOT TO SEE the cmdLinkRewActions at the start. But still it is showing up.
0
 
LVL 35

Accepted Solution

by:
girionis earned 250 total points
ID: 39958619
Ok try something else. Wrap the commandLink in a panelGroup.

<h:panelGroup id="panelId">
    <p:commandLink  id="cmdLinkRewActions" value="Review Actions" rendered="#{your render logic here}"
       actionListener="#{services.goToReviewActions ()}" />
</h:panelGroup>

Open in new window

0
 

Author Comment

by:prain
ID: 39958675
Now that works. Thanks.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question