Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In one of our page we have a search button that open a search dialog so that the users can search and import some data from a remote system.

Now got I new requirement that this same dialog must be showed every time the page is opened - but only when the page will be used to create a new registry, in the update mode it should be showed only if the user click the button.

I've already tried some things, I can call the dialog by MB using Primefaces engine as below:

 RequestContext.getCurrentInstance().execute("dialogArmaBos.show()")

This command Works great for the button case, but I can get it working when the page opens. If I try to use in the PostConstruct nothing happens.

I tried also <f:event type="preRenderView" ... with <f:metadata ... but nothing changes too.

Is there some way to make it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

According to the fabulous PrimeFaces documentation There is a visible attribute. Quote from the docs:

visible false Boolean When enabled, dialog is visible by default.

So simply use an EL in that attribute to have it show on pageload

<p:dialog visible="#{myBean.createMode}"... >

and have a boolean field in that bean that returns true if in creation mode.

For the rest you can show/hide it with the client-side api if needed


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...