Hi I need help with understanding DataView.

My code that construct the dataview is as follows (name changed to protect the guilty),

   IDataProvider<MyRecord> dataProvider = new MyRecordDataProvider();

DataView<MyRecord> dataView = new DataView<MyRecord>("summary", dataProvider)
       {
           SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
@Override
           protected void populateItem(Item<MyRecord> item)
           {
               MyRecord record = item.getModelObject();
           }

       };

   add(dataView);

In my hmtl I just bascially put:

   <table cellspacing="0" id="dsta-grid">
       <thead>
           <tr>

           </tr>
       </thead>
       <tbody>
           <tr wicket:id="summary">

           </tr>
       </tbody>

   </table>

I reduced the fields printed because I got the following error regarding markup

WicketMessage: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered).

1. [MarkupContainer [Component id = summary]] 2. [MarkupContainer [Component id = 1]] 3. [MarkupContainer [Component id = 2]] 4. [MarkupContainer [Component id = 3]] 5. [MarkupContainer [Component id = 4]] 6. [MarkupContainer [Component id = 5]] 7. [MarkupContainer [Component id = 6]] 8. [MarkupContainer [Component id = 7]] 9. [MarkupContainer [Component id = 8]] 10. [MarkupContainer [Component id = 9]]

This is really weird. It seems that Wicket is looking to render the tag id 1..9 (corresponds to the number of records in my list, whose iterator I returned.) Is my syntax wrong? Or does the problem lies with my data provider which implements the following

public Iterator<? extends MyRecord> iterator(int arg0, int arg1) { Session dbSession = HibernateUtil.GetSessionFactory().openSession(); try { List<MyRecord> list = dbSession.createCriteria(MyRecord.class).list(); return list.iterator(); } finally { dbSession.close(); } } @Override public IModel<MyRecord> model(MyRecord inmodel) { return new Model<MyRecord>(inmodel); } Lester



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to