0

I'm have something like this

<ui:repeat value="#{val}" id="repeatID" var="var">
    <h:panelGroup layout="block" id="blockForRender">
        <f:ajax execute="@this" render=":#{cc.clientId}:blockForRender"> text </f:ajax>
    </h:panelGroup>
</ui:repeat>

And this is make error - "cannot locate it in the context of the component". Why? And how I can do this?

No this not work. Maybe because ajax is in the other composite?

<ui:repeat value="#{val}" id="repeatID" var="var">
 <composite:otherComposite id="otherComposite">
    <h:panelGroup layout="block" id="blockForRender">
        <f:ajax execute="@this" render=":#{cc.clientId}:blockForRender"> text </f:ajax>
    </h:panelGroup>
 </composite:otherComposite>
</ui:repeat>
davgur
  • 9
  • 2
  • In future questions, it'd be helpful if you post **actually executabele** code (which we can just copy'n'paste'n'run without the need to do some changes based on educated guesses) instead of heavily oversimplified snippets (which actually don't compile and execute at all when copy'n'pasted). – BalusC Nov 14 '12 at 14:08

1 Answers1

2

Because the component with that ID doesn't exist at all. It's instead prefixed with the iteration index of the <ui:repeat> like so ccClientId:0:blockForRender. Open the page in browser and do View Source to see it yourself.

Just omit the absolute ID prefix to make it relative to the closest parent UINamingContainer (which is the <ui:repeat> itself in your particular —heavily oversimplified— snippet).

<f:ajax ... render="blockForRender">

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • As per your question update, assuming that this is still extremely oversimplified (the `` namely doesn't work on `` this way at all) This construct should still work just fine with `render="blockForRender"`. – BalusC Nov 14 '12 at 14:06