Table component losing data when scrolling and table cell doesn't lose focu

Hi,

I have a problem with the table component losing entered data when scrolling. The problem reproduces in demo application:

http://demo.vaadin.com/sampler/#ui/data-presentation/table

  1. make table editable (in all properties view)
  2. edit first row value in “CODE” column, do not lose focus
  3. using mouse wheel scroll table down to the bottom
  4. using mouse wheel scroll back to top
  5. your entered value has reverted to original value

How to tackle this problem? I use column generators and have tried to add blurlistener to generated cell text fields, but blur event doesn’t fire for those text fields that are destroyed when table is loading new rows.

If you scroll by dragging the scroll bar the problem doesn’t reproduce, since apparently value is updated to underlying bean when textfield loses focus. But when scrolling with mouse wheel there is no blur event.

If this can’t be fixed with the current vaadin version, is there a way to disable the mouse wheel in table scrolling? Therefore forcing user to drag the scroll bar.

I think the reason for your blurlistener not working is that the textfields aren’t actually loosing focus but get detached from the table. Maybe try using a DetachListener to maybe catch this event.

I’m not quite sure if there A is a way to “fix” it and B if this fix wouldn’t cause more problems then it would fix as this way i would think valuechangeevents would be called on detach in every textfield.

I don’t think there is a way to disable mouse wheel scrolling as it is a very basic browser feature.

PS: Just stumbled over
this
which might work for a Vaadin table as a Javascript Extension.

I found a jQuery-based workaround: register a scroll function for the table (function is invoked whenever table starts scrolling). Inside function find all inputs inside table and fire blur for all of them. Seems to work!