Problem Vaadin table with refreshRowCache and lost of Focus

Hi,

i have a problem with Vaadin table with editable field. When I change the value of an editable field I have some other fields of the table that need to be updated and shown. So I have to refresh my table with table.refreshRowCache () in the Blur event (When I left the editable field with click or TAB). The table his well renderer but the focus of the next field is loose.

I work with Vaadin 7.1.1

If someone have a good idea to make that, I appreciate :). I just want to have the focus in the good editable field after the refreshRowCache.

Thanks in advance,

Julian

Calling the method refreshRowCache() is quite a “radical” approach and does reset a number of things. There are cases where it cannot be avoided (e.g. when updates to objects backing the table take place from a background thread through a library that is out of the control of the application), though. Unfortunately, for some such situations, there isn’t really a better API in the current table.

The clean way would probably be updating the things that need to be updated using the Table or Container APIs instead of directly modifying the underlying beans. That way, Vaadin can know what has changed so there is no need to reset the whole cache from outside of Table and everything should just work automatically.

If, however, you do use refreshRowCache(), the interface Field extends Focusable so I think you should be able to call f.focus() for the appropriate field after resetting table. You can get the component that lost focus from a BlurEvent.

Thanks for the answer. I tried to use field.focus in Blur event, but the use of “refreshRowCache()” or just “data.getItem(itemId).getItemProperty(propertyId).setValue(“jkjj”)” seems to refresh the table and all the editable fields are a different Object than before the refresh. So the field.focus gives the focus to the former field.
May I have to use a Map to store all fields and put a data in field.setData(“jjjj”) and after each refresh to get the new field with field.getData() and compare the old with the new to find the good field in the Map?

I think it will be a very good improvement of Vaadin table to have this behaviour by default. Because lot of people want editable field and refresh the table. And they want to use click or TAB to navigate without loose the focus.

Thanks for your help,

Julian

I solve the problem with the solution I told previously but it’s not very nice. It will be good for the futur if Vaadin add this behaviour to the table component.

Sorry to dig out this old post, but issue has been fixed for Vaadin6 (https://dev.vaadin.com/ticket/11788) and not for Vaadin7.
Does somebody else have the same behavior : with an table in edit-mode, it looses focus if there is some calculated value in the table or in the footer ?

I created a ticket some weeks ago (https://dev.vaadin.com/ticket/16619) about this issue.

Regards