The Table/Tree/TreeTable/other select components always use a Container as a data source. The Container is responsible for things like sorting and filtering. Calling Table.getItemIds() will return those items the container gives to the Table, which will not include any filtered ones. Calling Table.getContainerDatasource().getItemIds() will return the complete set.