strange behaviour - table getvalue() doesn't work on first click

Maybe this is answered but I couldn’t find relevant answer sorry if I’m opening a duplicate. I’m using vaadin 6.8.2. I have a table object which has setimmediate true

    Table table = new Table();

               BeanItemContainer beanContainer = new BeanItemContainer<SomeBEAN>(SomeBEAN.class);
		table.setContainer(beanContainer);
		table.setSearchContainer(searchContainer);
		
		table.addStyleName("striped strong");
		table.setSizeFull();
		
		table.setSelectable(true); 
		[b]
table.setImmediate(true);
[/b]
		table.setNullSelectionAllowed(false) ;
		table.setColumnReorderingAllowed(true);
		table.setColumnCollapsingAllowed(true);
table.addListener(new ItemClickEvent.ItemClickListener() {
			public void itemClick(ItemClickEvent event) {
				//event.getItemId();  returns the itemid on first click but below method doesn't return 
				getTableValue();
				
			}
		});


//The below method is a overridden method for my application which shouldn't have any parameter (:( sorry one of the requirements)
public void getTableValue(){
      Object itemId =  table.getValue()   //getValue() returns null when nothing is selected and on first click, from second click it works fine
}

Can anyone look into this and let me know what’s wrong with my code or provide any alternate solution

Hi

I’m also experiencing the same problem. Any answers?

Thanks!

Item click listeners are invoked before/regardless of whether the Table value is changed; this is by design. You could instead add a ValueChangeListener; these are called only after the value is actually changed.