Hi, Please use some pastebin service with code highlighting next time. It is hard to follow it in a mail client. The problem is that you try to add a component (the DataView) on the fly when the form is submitted. You should add the dataview to the page or form when they are constructed and just populate its IDataProvider with data in onSubmit(); I.e. initially the DataView will render empty (invisible for the user) and will show itself after submit because it will have entries to show.
Martin Grigorov Wicket Training and Consulting On Tue, May 27, 2014 at 3:51 PM, kumar ramanathan <[email protected]>wrote: > Apologize Martin.Please tell how to fix my problem. Code snap is below for > your reference,kindly help on what needs to modified in that. > > public DemoHomePage () > { > Form form=new Form("homePageForm"){ > public void submit(){ > List<DemoBean> list = new ArrayList(); > list.add(new DemoBean("1","ram")); > list.add(new DemoBean("2","sam")); > > ListDataProvider<DemoBean> listDataProvider = new > ListDataProvider<DemoBean>(list); > > DataView<DemoBean> dataView = new > DataView<DemoBean>("row",listDataProvider){ > /** > * > */ > private static final long serialVersionUID = 1L; > > protected void populateItem(Item<DemoBean> item){ > DemoBean bean=item.getModelObject(); > RepeatingView repeatingView = new > RepeatingView("dataRow"); > repeatingView.add(new > Label(repeatingView.newChildId(), bean.getId())); > repeatingView.add(new > Label(repeatingView.newChildId(), > bean.getName())); > item.add(repeatingView); > } > }; > > add(dataView); > } > }; > > add(form); > } > > Html page: > > <html> > <body> > <form wicket:id="homePageForm"> > <input type="submit" value="ok"> > </form> > > > Id > Name > > > > > > </body> > </html> > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666039.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] > >
