Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Anyway to get itemId(private variable) from a IndexedContainer item?
Hi,
I would like to know if there is anyway to get the itemId value which is a private variable in the IndexedContainer item.
Thanks in advance.
Dinesh, I do not understand your question. In order to get an Item, you need to provide the itemId.
Could you provide more details maybe?
I am actually overridding the compareProperty method of the DefaultItemSorter.class .
Here I get two items which contain the itemId needed for implementing the sorting.
Hope its clear
An ItemSorter is used to compare two items by a given property. You can use somthing like the following to get the values of the properties that the ItemSorter has to use for the comparison:
Object value1 = item1.getItemProperty(propertyId).getValue();
Object value2 = item2.getItemProperty(propertyId).getValue();
Keep in mind that an itemID is something containers use to identify their contained items. Think of it as a way to ask for an item inside a Container, so in the context of an ItemSorter, there's no point of having any itemIDs as you already have the two items you need to compare (no need to ask for them).