I'm new to wicket and I fail to see how the proposed solution works.  Coping
this into the IDE, and even after correcting for caps, there are several
errors.  For one, add takes a component, not a component plus int[].  Also
IModel wanted to implement unimplemented methods. What I'm I missing?



igor.vaynberg wrote:
> 
> class mypage() {
>   static int[] pages=new int[] {10,15,20,25};
> 
>   public mypage () {
>     final DataTable dt=new datatable(..);
> 
>    add(new dropdownchoice("pages", new imodel() {
>        void setObject(Object e) { dt.setrowsperpage((Integer)e); }
>        Object getObject() { return td.getrowsperpage(); }
>        void detach() {}), pages);
> }
> 
> -igor
> 
> 
> On 8/26/07, janders <[EMAIL PROTECTED]> wrote:
>>
>>
>> The format of the Exception got munged with the example code. This should
>> read as:
>>
>> IllegalStateException: Attempt to set model object on null model of
>> component: rows
>>
>> final DataTable contacts = NEWDataTable("contacts", columns,
>> contactProvider, rowsPerPage) {
>>     @Override
>>     PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
>>         RETURNNEWOddEvenItem(id, index, model);
>>     }
>> };
>>
>>
>> janders wrote:
>> >
>> > I would like to be able to add a dropdown to a DataTable so that a user
>> > can change the rowsPerPage.  Has anyone done this before?  If not, what
>> is
>> > the best / recommended approach?
>> > I tried the following, but I get:
>> >
>> > IllegalStateException: Attempt to set model object on null model of
>> > component: rowsFINALDataTable contacts = NEWDataTable("contacts",
>> columns,
>> > contactProvider, rowsPerPage) {
>> >     @Override
>> >     PROTECTEDItem newRowItem(String id, INTindex, IModel model) {
>> >         RETURNNEWOddEvenItem(id, index, model);
>> >     }
>> > };
>> >
>> > List rows = Arrays._asList_(NEWString[] {"5", "10", "15", "20",
>> "all"});
>> > add(NEWDropDownChoice("rows", rows) {
>> >     @Override
>> >     PROTECTEDBOOLEANwantOnSelectionChangedNotifications() {
>> >         RETURNTRUE;
>> >     }
>> >     @Override
>> >     PROTECTEDVOIDonSelectionChanged(FINALObject newSelection) {
>> >         IF(newSelection == "all") {
>> >             contacts.setRowsPerPage(100000); // use really big number
>> to
>> > display all
>> >         } ELSE{
>> >             contacts.setRowsPerPage((Integer) newSelection);
>> >         }
>> >     }
>> > });
>> >
>> > - JA
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DataTable-with-DropDownChoice-to-set-rowsPerPage-tf4332526.html#a12339585
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/DataTable-with-DropDownChoice-to-set-rowsPerPage-tf4332526.html#a12361849
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to