1

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?

WurmD
  • 1,231
  • 5
  • 21
  • 42
  • You want the `change` event to be fired on page load? – Jasper de Vries Sep 21 '16 at 15:12
  • @JasperdeVries Uuh, I don't know if that makes sense or not. . I want, after page load, for the change event to fire at the first time the drop-down-menu-selection is changed (instead of only the second time forward). And/or for the tabChange event to fire the first time the tab is changed, instead of only the second time. – WurmD Sep 21 '16 at 15:46
  • Please read http://stackoverflow.com/questions/9844526/when-to-use-fviewaction-prerenderview-versus-postconstruct – Jasper de Vries Sep 21 '16 at 17:38
  • @JasperdeVries I... don't exactly understand how that applies here. What exactly is happening on the first time you change tabs or change the selectionMenu and invoke the Ajax call (and it doesn't run)? What else is being set that needs to be set; After knowing that then maybe it will be obvious how to set that thing that is missing with `@PostConstruct` or `f:viewAction` (note that my Bean class is currently `@ManagedBean @ViewScoped`) – WurmD Sep 22 '16 at 10:31
  • I'm failing to reproduce this bug on a smaller example. What else should I read to figure out what's going on? – WurmD Sep 28 '16 at 16:44
  • @JasperdeVries By adding a growlDescription to the init() of the Bean I can now observe that init() is being called on page load (correctly) and then when I change tabs it is called again while the ajax is not called. What do you imagine could be causing this behavior? – WurmD Sep 29 '16 at 09:52

1 Answers1

0

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"

WurmD
  • 1,231
  • 5
  • 21
  • 42
  • Now, if someone can and cares to share a light on why this is happening I think would be useful. – WurmD Sep 29 '16 at 10:04
  • See http://stackoverflow.com/questions/14692560/outcommented-facelets-code-still-invokes-el-expressions-like-bean-action-an – Jasper de Vries Sep 29 '16 at 11:01