What does the PF function do in Primefaces?

后端 未结 3 1149
太阳男子
太阳男子 2020-12-17 07:46

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 \"mak

3条回答
  •  感动是毒
    2020-12-17 08:16

    For other Primefaces users coming here when upgrading to version 4.0 and above, it's possible to bypass the need to use PF('yourWidgetVar').someFunction() and just use yourWidgetVar.someFunction() directly as you would have before version 4.0. You just need the following configuration in web.xml:

    
        primefaces.LEGACY_WIDGET_NAMESPACE
        true
    
    

    From the Primefaces User Guide:

    Enables window scope so that widgets can be accessed using widgetVar.method() in addition to default PF namespace approach like PF('widgetVar').method().

    Obviously you'd be susceptible to the namespace clash/pollution this feature was created to avoid, but it's useful if you want to migrate to a new version in little steps and isolate what incompatibilities the new version has introduced.

提交回复
热议问题