6 Replies Latest reply on Jan 13, 2010 5:44 PM by Nick Belaevski

    alternative to iteration counter variable for id attribute binding?

    v c Newbie

      hihi,

       

      i know the docs say that we cannot use iteration variables as value bindings... but are there any alternatives?

       

      i am creating components inside an iteration component and need to generate component ids that are unique per row.

       

      for example:

       

      <rich:orderingList value="#{myBean.myList}" var="rowObj" rowKeyVar="rowCounter">
      <rich:column>
      <h:inputText id="myTextField-#{rowCounter+1}" value="#{rowObj.value}" />
      </rich:column>
      </rich:orderingList>
      

       

      i want the above to have the following generated HTML source:

       

      <input id="myTextField-1" type="text" />
      <input id="myTextField-2" type="text" />
      <input id="myTextField-3" type="text" />
      <input id="myTextField-4" type="text" />
      

      but instead it generates this (note the resolved counter value is always the same):

       

      <input id="myTextField-1" type="text" />
      <input id="myTextField-1" type="text" />
      <input id="myTextField-1" type="text" />
      <input id="myTextField-1" type="text" />

      are there any other alternative solutions i can use?

       

      tia!

      -v