Hi,
On Fri, Mar 4, 2016 at 1:44 AM, andre seame <[email protected]> wrote:
> Hello,
>
>
> I try to understand the DataTableFilterToolbarPage. In Versin 6.21 and
> 6.22. I have 2 problems :
>
> * If I use the date filter to get 2 anwsers, I got exception.
> * If I suppress the exception (see the following paragraph), the
> "Pager" is not updated. So I have the 2 answer on the first page, but the
> "pager" says : Value from 1 to 8 / 50 and of course there are 7 links. Of
> course, goto page 2 will throw an exception.
>
>
> How to suppress the exception ?
>
> public Iterator<Contact> iterator(long first, long count)
> {
> List<Contact> contactsFound = getContactsDB().getIndex(getSort());
>
> return filterContacts(contactsFound).
> subList((int)first, (int)(first + count)).
> iterator();
> }
>
>
> If the sublist is < 8, then there is an exception on the first page. In
> fact the first page is not send because there is an exception.
>
>
> So, I replace the size of the sublist by;
>
> x = filterContacts(contactsFound) ;
>
> return x.subList((int)first, Math.min((int)(first +
> count),x.size()).iterator();
>
>
> if size of filterContacts(contactsFound) is 4, it is not possible to
> return a sublist form 1 to 8.
>
>
> Questions
>
> =========
>
> * Why does the on line example working ?
>
When there just 2 results the value of 'count' parameter is 2.
> * Is my correction good or do I miss something ?
>
Usually it is a safe bet. So keep it!
> * How to update the "pager" information, that is how to replace the
> initial list of 50 items, by a list of 2 items (or 0 items).
>
It seems your impl
of org.apache.wicket.markup.repeater.data.IDataProvider#size() is broken.
Set a breakpoint
at
org.apache.wicket.examples.repeater.SortableContactDataProvider#filterContacts()
and see how it works, i.e. what are the values and what are the callers.
>
> Thanks,
>
> PHL;
>
>
>
>