Function size() doesn't work properly

I show this problem with a simple example:

I have a table “AB” in my DB. It is “many to many” relationships table. AB container has it.

Id A B
1 1 1
2 2 2
3 3 1
4 3 2

I use filter: AB.addContainerFilter(new Compare.Equal(“A”, 3)); I get the last two lines that is fine. When I delete the last one. I do AB.removeAllContainerFilters(); and get the container with data:

Id A B
1 1 1
2 2 2
3 3 1

That’s fine.

When I use filter: AB.addContainerFilter(new Compare.Equal(“A”, 1)); I get the first line: (1; 1; 1;). BUT the size of this filtered container is 0 instead of 1.

Size() function for containers is:

public int size() {
updateCount();
return size + sizeOfAddedItems() - removedItems.size();
}

In this case size = 1, sizeOfAddedItems() = 0, removedItems.size() = 1 (because I removed one item). So the total by this calculation is 0 and it is the reason why I get it. But it should be 1. I tried using the function refresh() but it didn’t help. How to solve that?

Thank you in advance :wink:

Sounds like the container for the table tries to be more clever than what it is. that deleted count should be cleared when changing filters. Can you create a ticket about this at
http://dev.vaadin.com/newticket
?

Yes, exactly. I created the ticket with a number #9657. When can I expect to be this ticket solved?

I reformatted the ticket a bit to make it a bit more easy to read.

There are no guarantees on when a ticket is going to be fixed. If enough people express concerns about it, it will be lifted to a higher priority and the fix will come within the next releases.

If you are working for a company, you might be interested in a pro account. One of the benefits is bug fix priority. That means that you can choose whatever bug ticket in a stable release and mark it as a priority. That guarantees that the ticket will be assigned to someone within two business days.