Primefaces open closable dialog programmatically

前端 未结 1 511
夕颜
夕颜 2021-01-19 01:12

I want to dynamically create a primefaces dialog from the backing bean. I have written the code above:

public void s         


        
相关标签:
1条回答
  • 2021-01-19 02:08

    You need to replace this line:

    requestContext.openDialog("widget");
    

    to that:

    requestContext.execute("PF('widget').show()");     
    

    RequestContext.openDialog() method reffers to Primefaces Dialog Framework API which is different to p:dialog component.

    From primefaces user guide:

    Dialog Framework (DF) is used to open an external xhtml page in a dialog that is generated dynamically on runtime.

    So, RequestContext.openDialog() expects you to provide path to xhtml page as argument.

    And p:dialog component have javascript api show() and hide() methods to interact with it.

    0 讨论(0)
提交回复
热议问题