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

1

6

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?

Retrospective answered 28/7, 2013 at 12:12 Comment(0)
R
4

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?

Remmer answered 31/7, 2013 at 1:58 Comment(1)
Oh yes! After upgrading Mojarra this was simple. Thank you. :)Retrospective

© 2022 - 2024 — McMap. All rights reserved.