How to use <p: ​​blockUI> for the whole view?

I want to use <p:blockUI> to lock the entire view. But since the block attribute only accepts identifiers as keywords, and not, for example. @all , the only way I can see right now is to have a naming container (like <f:subview> ) to wrap the entire content of the view.

Unfortunately, this is semantically dirty, and I will need to rename all absolute identifiers, because a new noeccessary (except for <p:blockUI> ) id-prefix was created.

Is there a cleaner way to do this?

+6
source share
1 answer

Assuming I understand correctly, you can simply add id to h:body and specify that identifier in the attribute block <p:blockUI> . In addition, you will not need to change the identifiers of your components. Quick example

 <h:body id="wholeView"> <h:form> <h:inputText/><br/> <h:inputText/><br/> <p:commandButton id="pnlBtn" value="Block Panel" type="button" onclick="bui.show()"/> <p:blockUI block=":wholeView" widgetVar="bui"/> </h:form> </h:body> 

Again, this is just a stupid example that simply blocks the view for demo purposes. However, from what I understand from the answer below, you need to use Mojarra 2.1.8 or higher to use the id from h:body .

How to define body id attribute in JSF 2?

+4
source

Source: https://habr.com/ru/post/950463/


All Articles