java - How to refer to dataTable parent within the dataTable? -


consider dummy case:

<h:form id="wrapperform">     <h:panelgroup id="rowscontainer">         <h:datatable id="rowstable" value="#{bean.rows}" var="row" >             <h:column>                 <h:commandbutton value="click me update (#{component.parent.parent.parent.clientid})">                     <f:ajax render=":#{component.parent.parent.parent.clientid}" />                 </h:commandbutton>             </h:column>         </h:datatable>     </h:panelgroup> </h:form> 

on button click, id=rowscontainer gets updated should.

however, if add ui:repeat there, not work anymore:

<h:form id="wrapperform">     <ui:repeat id="blocksrepeat" var="block" value="#{bean.blocks}">         <h:panelgroup id="rowswrapper">             <h:datatable id="rowstable" value="#{block.rows}" var="row" >                 <h:column>                     <h:commandbutton value="click me 2 update (#{component.parent.parent.parent.clientid})">                         <f:ajax render=":#{component.parent.parent.parent.clientid}" />                     </h:commandbutton>                 </h:column>             </h:datatable>         </h:panelgroup>     </ui:repeat> </h:form> 

instead, gets:

<f:ajax> contains unknown id ':wrapperform:blocksrepeat:0:rowswrapper' - cannot locate in context of component j_idt363 

however, component there id, el should ok. somehow ui:repeat breaks case. possibly trying evaluate el before actual loop?

how refer rowswrapper element within datatable?

note: asked odd datatable naming within ui:repeat, turned out bug. issue should not related that, however, wrapping datatable within panelgroup suggested here.

there 2 things going wrong:

1) ui:repeat broken

as answered balusc in comments of question, first issue occurs (once again) due a bug in mojarra. seems ui:repeat broken wrapper container holding h:datatable not help. more details, see question "why doesn't h:datatable inside ui:repeat correct id?" , comments of question.

as balusc suggests, workaround use h:datatable instead of ui:repeat. provide unconvenient (<table>) html works. removes odd issues when adding , removing rows to/from inner iteration.

note: issues regarding ui:repeat seem fixed in mojarra 2.0.3 not all.

2) references fail

even h:datatable workaround, reference inner h:datatable button inside fails. there no ui:repeat in use, must datatable's internal issue. don't see solution @ moment, filed ticket behavior well.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -