开发者

jsf ui:repeat and using row value as an id

开发者 https://www.devze.com 2023-01-22 20:13 出处:网络
I have the following code <ui:repeat value=\"#{monitorForm.customerList}\" var=\"custRow\"> <h:outputText value=\"#{custRow.name}\"/><br/>

I have the following code

            <ui:repeat value="#{monitorForm.customerList}" var="custRow">
                <h:outputText value="#{custRow.name}"/><br/>    

                <rich:dataTable id="tbl_#{custRow.id}" var="row" value="#{custRow.orderList}">
                   <!--  show sales orders -->
                </rich:dataTable>
            </ui:repeat>

The generated HTML for each row is:

 <table cellspacing="0" cellpadding="0" border="0" id="monitorFrm:j_id392:0:tbl_" class="rich-开发者_Go百科table ">
      <colgroup span="0"></colgroup><tbody id="monitorFrm:j_id392:0:tbl_:tb"></tbody>
 </table>

In the output the id for the table is empty for each row: id="monitorFrm:j_id392:0:tbl_"

Is there a way to use dynamically use #{custRow.id} as the id for the table?

Or is there an other way to do this?


If I understand, you need to use that table Id from the client side by Javascript...

If yes, maybe you could use the varStatus of ui:repeat instead of the Id, and use that variable as id of DIV element:

<ui:repeat value="#{monitorForm.customerList}" var="custRow" varStatus="st">
            <h:outputText value="#{custRow.name}"/><br/>    

            <div id="#{st.index}">
                  <rich:dataTable var="row" value="#{custRow.orderList}">
                  </rich:dataTable>
            </div>

And if you need access from the client you could call the DIV and get the child...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号