0 Replies Latest reply on Nov 13, 2007 6:00 PM by msznapka

    Nested repeats bug

    msznapka

      Hello.

      I think that I found bug in nested repeats. I have following code:

      <h:commandLink action="#{repeatConversation.deleteItems}" value="commandLink"/><br/>
      <s:link action="#{repeatConversation.deleteItems}" value="sLink"/><br/>
      <ui:repeat value="#{repeatConversation.shoppingList.categories}" var="category">
       <ui:repeat value="#{category.items}" var="item">
       <h:inputText value="#{item.name}"/><br/>
       </ui:repeat>
      </ui:repeat>
      


      public String deleteItems() {
       Iterator<ItemCategory> iteratorCategories = shoppingList.getCategories().iterator();
       while(iteratorCategories.hasNext()) {
       Iterator<Item> iteratorItems = iteratorCategories.next().getItems().iterator();
       while(iteratorItems.hasNext()) {
       Item item = iteratorItems.next();
       if(item.getName().equalsIgnoreCase("thirdItem"))
       iteratorItems.remove();
       }
       }
       return null;
      }
      


      So the code is simple, I am repeating through nested collections, rendering some string as a value of a input field and there are two links with the same functionality: delete third item. If you press h:commandLink, than the third item is deleted on the server correctly, but on the client it is rendered incorrectly. S:link renders all inputs correctly. Here is picture how it works:



      Example

      Delete directory jboss-seam-2.0.0.GA/examples/numberguess and copy directory from the example, build, deploy on jboss-4.2.1.GA and run http://localhost:8080/seam-numberguess in browser.

      If this is not bug, please let me know how to solve it with h:commandLink, my app is waiting for solution ;)

      Thx
      msznapka