In the constructor that takes the company id in SortableUserDataProvider, you are retrieving all users for the specified company id and assigning that to the "users" class-level variable. But, in the iterator() method, you retrieve another subset (page) of users and assign it to the same "users" class-level variable. The size() method would then just return the number of records in the subset, but actually needs the total number of rows to page.
Here's an example SortableDataProvider (mostly stolen from the Wicket examples) which uses 2 queries... 1 to get the paged number of users and 1 to get the total count. Notice there is no need to return all users in the system (or in your case, for a specific company), which may be problematic from a performance standpoint. Feedback welcome: public class SortableUserDataProvider extends SortableDataProvider{ private static final long serialVersionUID = 271688819644192359L; /** * constructor */ public SortableUserDataProvider() { // set default sort setSort("firstName", true); } protected IUserService getUserService() { return ((KsxApplication)Application.get()) .getUserService(); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int) */ public Iterator iterator(int first, int pageSize) { SortParam sp = getSort(); int page = 0; if (first != 0) { page = first / pageSize; } return getUserService().findPage(page, pageSize, sp.getProperty(), sp.isAscending()).iterator(); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#size() */ public int size() { return getUserService().findTotalCount(); } /** * @see org.apache.wicket.markup.repeater.data.IDataProvider#model(java.lang.Object) */ public IModel model(Object object) { return new DetachableUserModel((User)object); } } -- View this message in context: http://www.nabble.com/DefaultDataTable-not-paging-correctly-tp16180335p16181887.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]