Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

jsf 2 - What does the PF function do in Primefaces?

On many places one can find usage of a function PF with Primefaces. For example in this answer

From what I have seen so far it seems to be a magic "make it work a little better" function. But I don't believe in this kind of stuff so:

What does this function do?

And where can I find documentation about it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

PF is a Javascript function.

In Primefaces 4.0 the Javascript scope of widgets changed. Prior to version 4.0 you could open a dialog widget with widgetVar.show();.

In Primefaces 4.0 and above the widgets are stored in a Javascript widget array. When you call PF('widgetVar') it is looking for the widget in the array and returning it.

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

I could not find much on this either this is what I was able to decipher using Chrome's developer tools.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...