views:

231

answers:

1

Hi,

I've made a button using HTMLPanelGrid and HTMLAjaxSupport (a4j:support from backing bean) that responds to 'onclick'.

The eventlistener registered with the HTMLAjaxSupport adds a component to the page (a different component with a different backing bean).

The problem is, the addition is not visible until I refresh the page or press another button that refreshes the display. I'm trying to figure out how to refresh the page.

To sum it up - I would like to know how to refresh a visual component backed up by a backing bean after the backing bean had changed. (The refresh should occur after clicking an ajax supported component)

Thank you!

+2  A: 

all <a4j: tags have the reRender attribute. It should point to the id of the object/area you want to refresh.

Note that if a component has been hidden, you must reRender its parent. For example:

<h:panelGroup id="newComponentWrapper">
<!-- your component goes here -->
</h:panelGroup>
...
<a4j:support reRender="newComponentWrapper" .. />

And another advice - avoid using the binding attribute - in 95% of the cases you can go without it.

Bozho
Thanks!About the binding attribute - How would you add and change components dynamically without it? (That's the main reason why I use binding currently)
Ben
just use `rendered="#{condition}` for a component, then change the condition and reRender
Bozho