I am working on task to send sms and part of that I need to show a busy loader and I have tried primefaces p:blockUI which is not working at all. The block UI is not get shown when triggered from a datatable button row. Here is my code that is not working. I am using primefaces 5.3. Its like each button in the table is getting assigned its own unique id which means the id specified in the Ui block trigger isn't the one on the button row clicked.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<body>
<ui:composition template="./template/template.xhtml">
<ui:define name="pageTitle">
Send Sms
</ui:define>
<ui:define name="pagecontent" id="blocker">
<p:panel id="panel_sms" header="My Contacts">
<p:blockUI block="panel_sms" id="wds" widgetVar="wds" trigger=":form1:tbl:btn_send_sms" >
<p:graphicImage library="images" value="/img/3.gif"/>
<br/>
<h:outputText value="Sending Sms Please wait... " style="font-weight: bolder"/>
</p:blockUI>
<h:form id="form1">
<p:growl showDetail="true"/>
<p:dataTable rowKey="#{item.id}" paginator="false"
rows="8"
editable="true" widgetVar="table_route"
id="tbl"
value="#{model.loadContacts}" var="item" >
<p:column style="width: 15%;">
<f:facet name="header">
<h:outputText value="Customer Name"/>
</f:facet>
<h:outputText value="#{item.name} "/>
</p:column>
<p:column style="width: 15%;">
<f:facet name="header">
<h:outputText value="Contact"/>
</f:facet>
<h:outputText value="#{item.contact} "/>
</p:column>
<p:column headerText="Send Sms" style="width:8%;align-content: center">
<center>
<p:commandButton id="btn_send_sms" update="form1"
style="background: #4a148c" value="Send Sms" icon="ui-icon-signal-diag" action="#{model.doLenthyTask(item)}"><--Have simulated a threaad to sleep 5 seconds-->
<p:confirm message="Send Sms?"/>
</p:commandButton>
</center>
</p:column>
</p:dataTable>
</h:form>
</p:panel>
</ui:define>
</ui:composition>
</body>
But when I try trigger it in a button not in a datatable it works fine.