Solved

How to make a p:commadLink visible/invisible?

Posted on 2014-03-26
4
634 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.

726 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