I have a master-detail view in my application represented by a table and a form
What I would like to achieve is:
If I update a textfield in the form, then I would like to see the changes in the table as well not just after the textfield looses focus ( on blur event maybe? )
How can I do that?
It is a bit strange that it is possible to to update the database as I type, but the changes in the table can only be seen after I click outside the textbox…
The basic table item editor form pattern is demonstrated in
this example . It should work with a container bound to a database as well (adding new items would cause problems though). But I guess you have already done that.
When a TextField is in immediate mode, the value changes are sent to the server only when the TextField loses focus (on blur event), not as you type.
I’m not quite sure what you want - do you want to see the changes in the Table as you type them in the TextField? Then you have to listen for text change events, as in
this example . But text change events do not cause a value change event for the TextField value, so it will not be updated in the Table.
Strange, I was thinking that you could perhaps call setValue() for the TextField manually with “tf.setValue(event.getText())” in the text change listener, but looks like it causes an infinite event loop. The JavaDoc says that “TextChangeEvents are only fired if the change is triggered from the user”, so this might be a bug. Well, setting the value manually on the server-side would probably cause other problems as well, as the change would be synchronized to the client-side to the same component which you are currently editing, which could mess things up.
So, if you really want to update the TextField content to its data source as you type, the TextField can’t be bound to the data source directly, but through some other mechanism.