Container Filter Item clone

I am wondering how to achieve the following need in the best way:

I have a container that contains several (always around 100) Items from a database. This container has also a table attached to display its bean items. In a different window, I have a widget that only displays the 5 most recent items.

I want to get these 5 recent items by filtering and not modifying the container instance.

Any help?

I’m not quite sure what you mean by not modifying the container instance. Container filters are handled in containers themselves, so setting a container filter modifies the container object in that sense.

There is no particular filter for filtering the m latest items from a container. You’ll have to determine the index of the mth latest item and use the GreaterOrEqual filter for the index. Perhaps there are some other ways as well, depending on the container.

ya the filtering is clear. i already have a filter. the problem is that the two views operate on the same container (and on the same items).

Something like Container.getFilteredItems(Filter f) that would return a Subcollection of the contained items (and does not change the tableview that shows all items) would be what i want. The question is how to implement best practice.

Sounds like hard to do with a single container. You could use a virtual “view” container wrapper over the actual one to get a smaller view. I don’t know if there is any suitable existing one in Directory. The LazyContainer in ArrayContainer could make it a bit easier I think.