I am using PrimeFaces 3.2 in my project. I wanted to know what is the difference between setting the rendered attribute of a <p:dialog>
as against setting the visible attribute. When should I use either of these attributes?
相关问题
- java.lang.NullPointerException at java.io.PrintWri
- java.lang.NullPointerException at java.io.PrintWri
- h:selectOneMenu in p:dataTable doesn't submit
- h:selectOneMenu in p:dataTable doesn't submit
- PrimeFaces block UI does not work when the compone
相关文章
- How to allow numbers only using f:validateRegex
- JSF 2.0: ajax request when press ENTER
- Formatting a double in JSF
- How to override primefaces component api class wit
- f:convertNumber on Double: ClassCastException
- SeamPhaseListener - Could not start transaction -
- How do I access EJB bean when inside a custom Conv
- Getting value from dynamically created inputText
According to the documentation for those attributes, section 3.28:
The
rendered
attribute is server-side and thevisible
attribute is client-side. Therendered
attribute tells whether JSF should generate the dialog's HTML representation or not. Thevisible
attribute tells whether HTML/CSS/JS should immediately show the dialog on browser's page load or not.If the dialog isn't rendered, then you won't be able to display it by for example JavaScript
dialogWidgetVar.show()
without reloading the page or ajax-updating one of the dialog's parent components that way so that the dialog'srendered
condition evaluates totrue
. Also thevisible
attribute won't have any effect if the dialog is not rendered simply because there's nothing being rendered to the resulting HTML output which could be shown/hidden by JavaScript.If the dialog is rendered, then it is by default hidden. You can set
visible
totrue
to force it to display the dialog immediately whenever the page is opened. Or you can invoke JavaScriptdialogWidgetVar.show()
in someonclick
oroncomplete
attribute to show it.Use the
rendered
attribute if you don't want to render the dialog at all, for example because it wouldn't ever be used anyway in the currently requested page composition.