Solved

How to make a p:commadLink visible/invisible?

Posted on 2014-03-26
4
583 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Now that works. Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now