Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use <p:blockUI> on whole view?

I want to use <p:blockUI> to block the whole view. But as it's attribute block does only accept ids as keywords and not e.g. @all, the only way I currently see is to have a naming container (e.g. <f:subview>) to wrap the whole content of the view.

Unfortunately that's semantically dirty and I would need to rename all absolute ids because a new unneccessary (except for <p:blockUI>) id-"prefix" has been created.

Is there a cleaner way to do this?

like image 760
Lester Avatar asked Jul 28 '13 12:07

Lester


1 Answers

Assuming I understand correctly, you could simply add an id to h:body and reference that id in the block attribute of <p:blockUI>. Also, you wouldn't need to change the ids 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 silly example which simply blocks the view for demonstration purposes. However, from what I understand from the answer below, you would need to be using Mojarra 2.1.8 or higher to use the id from h:body.

How to spefic the body id attribute in JSF 2?

like image 73
Andy Avatar answered Nov 08 '22 14:11

Andy