0

I am using buttons in a p:datatable and they are triggering a p:blockUI (PF 6.0)

When located in the footer of my datatable, the button does trigger the blockUI. When moved into a column, it does not trigger it

BlockUI

<p:blockUI block="blockPanel"
    trigger="myForm:myTable:myButton myForm:myTable:myButton2">
            Loading..<br />
    <p:graphicImage name="images/loading_blue.svg" />
</p:blockUI>

Datatable

<p:panel id="blockPanel">
    <h:form id="myForm">
        <h:panelGrid columns="1" cellpadding="5">
            <p:dataTable id="myTable" value="#{modelBean.myList}" var="entry">

                <!-- Some data -->
                <p:column headerText="Name">
                    <h:outputText value="#{entry.name}" />
                </p:column>

                <!-- Does not work -->
                <p:column style="text-align: center">
                    <p:commandButton id="myButton" actionListener="#{bean.method()}" />
                </p:column>

                <!-- Works -->
                <f:facet name="footer">
                    <p:commandButton id="myButton2" actionListener="#{bean.method()}" />
                </f:facet>

            </p:dataTable>
        </h:panelGrid>
    </h:form>
</p:panel>

Why ?

The following workaround did not work for me:

<p:commandLink ... onclick="bui.show()" oncomplete="bui.hide()">
...
<p:blockUI widgetVar="bui" />
Tim
  • 3,910
  • 8
  • 45
  • 80
  • i know that it is sound very weird but try `trigger=" :myForm:myTable:myButton , :myForm:myTable:myButton2"` – Yagami Light Oct 21 '16 at 20:11
  • It does sound weird, but did not trigger the BlockUI :( – Tim Oct 24 '16 at 08:13
  • did you add `blocked` to make a condition how the blockUi will appear and disappear – Yagami Light Oct 24 '16 at 08:18
  • What do you mean ? – Tim Oct 24 '16 at 08:19
  • use my blockUI and tell me if it's working ` ... ` – Yagami Light Oct 24 '16 at 08:22
  • It did not work. However when I put simply blocked="true", it is always blocked. So the problem still comes from the trigger. – Tim Oct 24 '16 at 08:57
  • Possible duplicate of [How to reference p:commandLink in p:dataTable from p:blockUI trigger?](http://stackoverflow.com/questions/14893751/how-to-reference-pcommandlink-in-pdatatable-from-pblockui-trigger) – Kukeltje Oct 25 '16 at 07:45
  • I had found that question too - but it is already 3 years old... I don't know what got fixed in PF6 with regards to this issue – Tim Oct 25 '16 at 08:24
  • 'Nothing' got fixed – Kukeltje Oct 25 '16 at 08:30
  • And if you find related questions when looking for a solution that do not help or you do not know if it is related or not, [ask] states to post that. Saves us from doing identical searches. – Kukeltje Oct 25 '16 at 08:40
  • Probably related: http://stackoverflow.com/questions/26524531/referencing-datatable-footer – Jasper de Vries Oct 25 '16 at 09:33
  • The workaround from the other p:commandLink question did not work for me, I assumed it was part of the same problem. I'll update my question – Tim Oct 25 '16 at 10:43

2 Answers2

0

As a workaround, I used pe:blockUI:

http://www.primefaces.org/showcase-ext/sections/blockui/blockPage.jsf

Tim
  • 3,910
  • 8
  • 45
  • 80
-2

What I mean : You don't have any value in your datatable. Put it one, you can create a backingBean return one value and add property value=#{myBean.value}. Also you have data on you datatable ! Test it

bug007
  • 57
  • 6
  • There are values in the DataTable. I left them out to focus on the problem. I updated the first post.. – Tim Oct 24 '16 at 08:13