Problem deselecting table.

I have a problem deselecting table.
I have a multi selection table, a few lines must not be selected (true state).
When I select a line that should not be selected, it should display a message “This line should not be selected” and cleared the line.

table.addListener(new ItemClickEvent.ItemClickListener() {

            public void itemClick(ItemClickEvent event) {
                Object itemId = event.getItemId();
                if (!event.isDoubleClick()) {
					if (!((ExtractSuiviEncour)itemId ).getEtat()) {
							TPTApplication.getCurrentApplication().getMainWindow().showNotification("This line should not be selected");

What happens: I get the message “This line should not be selected” and the line is cleared when I table.getValues ​​().
But the appearance of this line is still selected in blue.

I want this line is cleared and returns to normal color.

Thank you for your help.

Hi Mallek,

Your problem comes from that the ItemClickListener in the table is fired before the table value is updated. Hence, the table.unselect(itemId); will have no effect for the table, when done in the ItemClickListener because the table value is updated with the values from the client-side after the ItemClickListeners have been processed.

As a workaround you could use the ItemClickListener to check for the clicked item and then handle the unselect in a ValueChangeListener:

table.addListener(new ItemClickListener() {

            public void itemClick(ItemClickEvent event) {
                if (illegalTableValues.contains(event.getItemId())) {
                    illegalValue = event.getItemId();

                            "Illegal value selected: " + event.getItemId());

        table.addListener(new Property.ValueChangeListener() {

            public void valueChange(ValueChangeEvent event) {

                if (illegalValue != null) {
                    illegalValue = null;

Kind regards