selective update with p:ajax disabled attribute

UI Components for JSF
Post Reply
colm.mchugh
Posts: 7
Joined: 10 Aug 2011, 17:30

29 Aug 2011, 17:35

Hi PF users,

I want to implement that when a component value changes, another component may get updated, depending on a boolean value in the backing bean. I'm attempting to implement this using the disabled attribute of p:ajax - disable the ajax behavior (don't do the update) if disabled resolves to true. This is the relevant xhtml:

Code: Select all

<h:selectManyMenu >
  <p:ajax  update="comp_id"  disabled="{!bean.hasXproperty()}" />
</h:selectManyMenu>

<h:panelGrid id="comp_id" >
  <!-- PF and F components -->
</h:panelGrid>
relevant Java bean code:

Code: Select all

public boolean hasXproperty() {
  if // some value
     return true;
  else
     return false;
}
A page can have several of these components (they're processed in a ui loop) and some may need to update the comp_id component, depending on bean.hasXproperty(). But, what I'm seeing is that the comp_id component is never updated, in other words the ajax behavior is effectively disabled for all components. In the page source, I don't see any javascript to update the comp_id component.

Is this the right use of disabled attribute? I'm thinking of changing to using a listener that updates the comp_id component's values, but would like to understand what the issue or misunderstanding might be with the disabled attribute.

Note -- I'm using h:selectManyMenu because of a known issue with p:selectManyMenu in PF 3.0.M1 (where it does not display the selected values when you return to the page)
PF: 3.0.M3, JSF: 2.0, AS: GF 3.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 58 guests