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]