Hi, 1)use dataview +reuseifmodelsequalstrategy 2) model object should be your data object and not component, see examples in the wicket distribution.
On Wed, Feb 13, 2013 at 3:06 AM, Celia Xu <[email protected]> wrote: > Hi, > I want to use a repeater to paint my panels so now I have a listview which > only remove the last item in the list. I browsed and found some people > recommend to use refreshingView but I'm not sure how to populate my panel > items. > any suggestion? > thanks > > LinkedList<myPanel> myPanelList= new LinkedList<myPanel>(); > > RefreshingView refreshingView = new RefreshingView<myPanel >>("myPanel "){ > @Override > protected Iterator<IModel<myPanel >> getItemModels() { > > *//HOW to convert my panel object to IModel?* > } > > @Override > protected void populateItem(final Item<myPanel> item) { > item.add(item.getModelObject()); > int index = item.getIndex() ; > item.add(new Label("index", (index +1 )+ ".")); > > AjaxFallbackButton removePanelLink = new > AjaxFallbackButton("remove", form) { > @Override > protected void onSubmit(AjaxRequestTarget > ajaxRequestTarget, Form<?> form) { > interactivePanels.remove(item.getIndex()); > if (ajaxRequestTarget != null) { > ajaxRequestTarget.add(wmc); > } > } > }; > > removePanelLink.setDefaultFormProcessing(false); > removePanelLink.setOutputMarkupId(true); > item.add(removePanelLink); > } > }.setItemReuseStrategy(new ReuseIfModelsEqualStrategy()); > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/How-to-remove-panel-in-a-list-tp4656293.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- regards, Vineet Semwal --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
