I understand, but being a newbie, this makes little sense. Where is
wantOnSelectionChangedNotifications()
and onSelectionChanged(). Aren't these require? How does the selection
value get passed to rowsPerPage? Can you point me to a working example?
BTW, I'm currently using Wicket 1.2.3.
igor.vaynberg wrote:
>
> heh, you have to meet us half way here. you cant expect to be able to
> paste
> pseudocode into the ide and have it compile and work.
>
> the int[] param is intended to be the third constructor param of
> dropdownchoice not the second param of add().
>
> if you are using an older wicket ver - 1.2 then imodel has an extra
> component param which you can ignore
>
> my point is: look at what the example is trying to do.
>
> -igor
>
>
> On 8/27/07, janders <[EMAIL PROTECTED]> wrote:
>>
>>
>> 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]
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/DataTable-with-DropDownChoice-to-set-rowsPerPage-tf4332526.html#a12362157
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]