see ListDataProvider

-igor

On Feb 13, 2008 7:44 AM, wiki <[EMAIL PROTECTED]> wrote:
>
> Hi I have a little problem with displaying list inside datatable.
> I have a list of questions and each question has a list of answers.My design
> requirement is to  display one question per page(that's why used Data
> Provider) and within that page I have to display list of relevant answers.I
> have a java classes(User,Questionaire,Questions,Answers) User class has List
> of Questionaire and that(Questionaire) has list of questions Then Question
> class has a list of Answers.So from Lecturer  WebPage I can click a
> questionaire link to go to questionaire Page which display list of
> questionaire(using ListView).From questionaire I did manage to display
> Questions.Could anybody   know how to embed list in Data Table to display
> answers.
>
> Thanks
>
> public class ShowQuestions extends WebPage
>
> {
>
> //
> //    /** Creates a new instance of ShowQuestions */
> //        List questions=qaire.getMcssquestion();
> //        ListView list=new ListView("questionaire",questions)
> //        {
> //            protected void populateItem(ListItem item)
> //            {
> //                final MCSSQuestion
> mcssquestion=(MCSSQuestion)item.getModelObject();
> //
> //                item.setModel(new CompoundPropertyModel(mcssquestion));
> //                item.add(new Label("questiontext"));
> //                item.add(new Label("questionaire.Title"));
> //
> //
> //            }
> //
> //        };
> //        add(list);
> //    }
>     public ShowQuestions(final Questionaire qaire)
>     {
>
>         SortableDataProvider provider= new SortableDataProvider()
>         {
>             // Return how many rows there are
>             public int size()
>             {
>                 return qaire.getMcssquestion().size();
>             }
>             // convert each row object as a model
>             public IModel model(Object object)
>             {
>                 MCSSQuestion mcss=(MCSSQuestion)object;
>                 return new Model((Serializable) mcss);
>             }
>             public Iterator iterator(int first, int count)
>             {
>                 return qaire.selectEntries(first,count).iterator();
>             }
>         };
>         IColumn[] columns= { new PropertyColumn(new
> Model("ID"),"questiontext")
>         };
>
>         DefaultDataTable datatable=new
> DefaultDataTable("eachentry",columns,provider,1);
>         add(datatable);
>     }
>
> --
> View this message in context: 
> http://www.nabble.com/How-to-Display-List-in-DataTable-tp15459611p15459611.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to