Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...