You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by andre seame <an...@hotmail.fr> on 2016/03/04 01:44:25 UTC
Bug in example ? repeater.DataTableFilterToolbarPage
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 ?
* Is my correction good or do I miss something ?
* 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).
Thanks,
PHL;
RE: Bug in example ? repeater.DataTableFilterToolbarPage
Posted by andre seame <an...@hotmail.fr>.
You have right, the "size" was broken.
Thanks
PHL.
________________________________________
De : Martin Grigorov <mg...@apache.org>
Envoyé : vendredi 4 mars 2016 07:26
À : users@wicket.apache.org
Objet : Re: Bug in example ? repeater.DataTableFilterToolbarPage
Hi,
On Fri, Mar 4, 2016 at 1:44 AM, andre seame <an...@hotmail.fr> 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;
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bug in example ? repeater.DataTableFilterToolbarPage
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Fri, Mar 4, 2016 at 1:44 AM, andre seame <an...@hotmail.fr> 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;
>
>
>
>