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
Solved

How to make a p:commadLink visible/invisible?

Posted on 2014-03-26
4
623 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
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…
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.

828 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