TextField Auto-Update

Hi,

I’m trying to use a TextField to auto-update the rows in a table consisting of one column. If the user for example typed in “a” then the table should display all rows with items starting with an “a” and filter all the other stuff.
However, I noticed that the method valueChanged for the TextField is only invoked when the user sets focus out of the text field, and not by changing the content of the TextField.

So is this possible or should I just use the ComboBox with suggestions and that’s it?

Thanks in Advance

Check out Henrik’s
SuperImmediateTextField
, I think it does exactly what you want.

Hi,

Yes, in the immediate mode, the ValueChange event is sent when the TextField loses focus, so it’s not quite as “immediate” as the name might imply.

You can use the
SuperImmediate TextField
to get the event for every keypress “more immediately”. It causes a lot of server requests, but so does ComboBox, one for each keypress. However, the response is more optimized for ComboBox; updating Table contents would be a bit bigger=slower change. It depends a lot on the size of the table how long it takes to render (how many rows*cols are visible).

Implementing filtering for Table should be trivially easy if you’re using IndexedContainer or BeanItemContainer, as they implement Filterable. Just add the filter string with [tt]
addContainerFilter()
[/tt]. You have to remove the filter for every change first.

So, ComboBox is a bit easier and probably faster, but you could try the SuperImmediateTextField+Table as well and see if it’s fast enough.

Thanks that was very helpful. I implemented it and it’s working fine