Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax render outside of form problem

 
Robe Eleckers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a problem with Ajax partial rendering. My (simplified) situation is as follows:

Flow (how I want it):
1. <cu:menu> component renders an html link like: <a href="#" onclick="mojarra.ab('j_idt9:j_idt10',event,'click',0,'content',null)">Click</a>
2. Clicking on this link should first call the ajax listener #{myListener.update}. This listeners changes the value of '#{myBean.value}'.
3. Now the component with id 'content' should be re-rendered and show the updated value of '#{myBean.value}'

However, in reality step 2 and 3 are switched, so first the rendering is done, then the listener is called. So only after the second click I see a content change.

Any ideas how to handle this?

Update:
I had a feeling this behavior is because I try to render something outside my ajaxified form. So I added the same outputText tag inside my form and render that at the same time as my outputtext outside the form.

Now I see the following sequence when clicking a link generated by the cu:menu component:
1. Component with id 'content' is rendered (outside the form).
2. #{myListener.update} is called, this changes the value of myBean.value.
3. Component with id 'test' is rendered (inside the form).

This causes the component outside of the form to be re-rendered without the value being changed first. Any ideas on how to change this?

Robe

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic