Hide button (p:commandbutton), Primefaces, with PF api

Asked

Viewed 349 times

1

I’m trying to accomplish something seemingly simple, but I’m taking a hell of a beating... Studying, I read that Primefaces has a javascript / jquery api, so I decided to take a look. Turns out I can’t hide (Hide), a button at all, tried several ways and nothing...

I am posting below some of the ways I tried, if I am forgetting something, please help me :)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">


<h:head>

</h:head>

<h:body>


<h:form id="form1">

    <p:commandButton value="Hide" onclick="PF('oi1').hide();" id="aa1" update="form1"  />       
    <p:commandButton id="hh1" widgetVar="oi1" value="teste" />
            <br></br>
    <p:commandButton value="Hide" onclick="PF('form1:oi2').hide();" id="aa2" update="form1" />      
    <p:commandButton id="hh2" widgetVar="oi2" value="teste" />
            <br></br>
    <p:commandButton value="Hide" onclick="PF('#form1:oi3').hide();" id="aa3" update="form1" />         
    <p:commandButton id="hh3" widgetVar="oi3" value="teste" />
            <br></br>   
    <p:commandButton value="Hide" onclick="PF('#oi4').hide();" id="aa4" update="form1" />       
    <p:commandButton id="hh4" widgetVar="oi4" value="teste" />
            <br></br>
    <p:commandButton value="Hide" onclick="oi5.hide();" id="aa5" update="form1" />      
    <p:commandButton id="hh5" widgetVar="oi5" value="teste" />
            <br></br>
            <br></br>
            <br></br>
    <p:commandButton value="Hide" onclick="PF('oi6').hide()" id="aa6" update="form1" type="button"  />      
    <p:commandButton id="hh6" widgetVar="oi6" value="teste" />
            <br></br>
    <p:commandButton value="Hide" onclick="PF('form1:oi7').hide()" id="aa7" update="form1" type="button" />         
    <p:commandButton id="hh7" widgetVar="oi7" value="teste" />
            <br></br>
    <p:commandButton value="Hide" onclick="PF('#form1:oi8').hide()" id="aa8" update="form1" type="button" />        
    <p:commandButton id="hh8" widgetVar="oi8" value="teste" />
            <br></br>   
    <p:commandButton value="Hide" onclick="PF('#oi9').hide()" id="aa9" update="form1" type="button" />      
    <p:commandButton id="hh9" widgetVar="oi9" value="teste" />
            <br></br>
    <p:commandButton value="Hide" onclick="oi10.hide()" id="aa10" update="form1" type="button" />       
    <p:commandButton id="hh10" widgetVar="oi10" value="teste" />

</h:form>

</h:body>
</html>

1 answer

1


I found in the Primefaces forum that it is not possible to hide using PF, p:commandbutton does not have this possibility. I did it in jquery anyway.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.