This content has been marked as final.
Show 1 reply
-
1. Re: Data Binding: Force synchronization on keyup event.
csa Nov 28, 2014 5:59 PM (in response to cpuffalt)Hi Corey,
UI changes are synced to the model using value change events. In the case you describe, it should be enough to do the following:
inputField.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if(event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { ValueChangeEvent.fire(inputField, inputField.getValue()); // trigger your server call } } });
or if you're using @Templated:
@EventHandler("inputField") private void onKeyUp(KeyUpEvent e) { if(e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { ValueChangeEvent.fire(inputField, inputField.getValue()); // trigger your server call } }
You're right that this would be a good feature to add though (configure the event to sync on). Do you want to create a JIRA for use with an API proposal? Of course, you're also welcome to send a pull request if you're interested.
Cheers,
Christian