WurmD WurmD - 2 months ago 12
Ajax Question

Ajax not being called the first time right after page load

I have two ajax calls in my page https://gist.github.com/WurmD/b01dfc88ef2f707d9d57ef7022af2f60
(with bean https://gist.github.com/WurmD/d606f54776f27bf1b2d13ac1562bad9d which is

@ManagedBean @ViewScoped
)

<p:tabView id="tabView">
<p:ajax event="tabChange" listener="#{provisioningBean.setOperation}" update=":form:growl" />


and

<p:selectOneMenu id="productDropMenuAct" value="#{provisioningBean.product}">
<p:ajax event="change" listener="#{provisioningBean.onProductChange}" update="equipmentDropMenuAct rangeActId equipmentDropMenuActLabel serviceDropMenuActLabel serviceDropMenuAct" />


Neither is being called right after page load.
After I change the tab once, or change the selectOneMenu once, then all subsequent ajax calls work.

Is this a bug?
Am I missing something?

Answer

The following block of comment was causing this unexpected behavior

<!-- 
                    <p:autoComplete id="cfsIdsuspend" 
                        value="#{provisioningBean.cfsIdSuspend}"
                        completeMethod="#{provisioningBean.completeCfsId}" >
                    </p:autoComplete>
                    <p:watermark for="cfsIdsuspend" value="CFS ID"  />

                    TO CENTER TABLE
                    <p:dataTable style="width:250px; margin: 0 auto;" 
 -->

delete it, and "All is well"