Hi, I just developed a Menu; that is nested many levels. At the point of rendering in my code I'm slightly confused. ok, Let the code talk:
(The following code assumes a domain model with "MenuItemState" which is hiararchial has children. And each child node is a "MenuItemState". The child can either have "null" or further children. The renderMenu() is called by a Panel.) @Override public void renderMenu() { IModel<MenuItemState> modelState = getState(); MenuItemState state = modelState.getObject(); //Add all menu state objects as Ordered List / sub lists. add(new ListView<MenuItemState>("menuItems", state.getChildren()) { @Override public void populateItem(final ListItem<MenuItemState> wrappedChildComponent) { final MenuItemState childItemState = wrappedChildComponent.getModelObject(); wrappedChildComponent.add(new Label("name", childItemState.getMenuItem().getName())); wrappedChildComponent.add(new StaticImage("img", new Model(childItemState.getMenuItem().getImg())) ); wrappedChildComponent.add(new StaticImage("rollOverImg", new Model(childItemState.getMenuItem().getRollOverImg())) ); wrappedChildComponent.add(new Label("selected", Boolean.toString(childItemState.isSelected()))); } }); .. now I can add the children like: wrappedChildComponent.add(new ListView("nestedItemsFor_"+childItemState.getMenuItem().getName(), childItemState.getChildren() {...} ); Code: Current markup code:: <table> <tr wicket:id="menuItems"> <td></td> <td> </td> <td> </td> <td> </td> </tr> </table> ..but how will the above markup code generate the name for the nestedItem Component & know if the item has children. Should I just inject markup mylsef or using ListView<> can achieve this cleanly? I want to introduce nesting from my Model into the markup using ListView! Ideas?! (I dont wanna keep posting answers to my own questions so quick replies would help :) ) heh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dunamic-neted-List-Views-tp2970644p2970644.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org