Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces PF function

OK, I use JSF with Primefaces Glasfish 5.X + server. I want to know how it works exactly the PF function as I need to corroborate or a widget is not visible in the view. My idea was

<h:form>
         <p:hotkey bind="ctrl+shift+s" handler="notify()"/>
</h:form>
            <h:outputScript>
                function notify(){
                    if(PF('bar').is(':visible')){
                        PF('bar').hide();
                    }
                    else{
                        PF('bar').show()
                    }
                }
            </h:outputScript>

But, tada : Google Chrome said "Uncaught TypeError: PF(...).is is not a function".

My existential question is: where is the documentaciond PF function ? or at least would solve this problem. Thanks people.

like image 844
Gonza Avatar asked Dec 06 '25 09:12

Gonza


1 Answers

The pf function select a widget in a widget array.

if you check the source code of primefaces.js (or something like that ):

PF = function(d) {
    var c = b.widgets[d];
    if (!c) {
        b.error("Widget for var '" + d + "' not available!")
    }
    return c
};

b seems to contain a lot of stuff including an array of widgets.

you can open the page containing the javascript by opening a page where you have primefaces included and in the head there will be something similar to this :

<script type="text/javascript" src="/yourNameSpace/javax.faces.resource/primefaces.js.xhtml?ln=primefaces&amp;v=5.2"></script>

then you can right clip and open it but the file won't contain any space etc to be less heavy. Just copy everything (ctrl+a then ctrl+c) go to eclipse paste it and format it (ctrl + shift +f).

like image 69
Ced Avatar answered Dec 07 '25 23:12

Ced



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!