简体   繁体   English

从Vaadin TextField中取消编辑/移除焦点

[英]Un-editing / removing focus from a Vaadin TextField

Does anyone know how to cancel the editing state of a Vaadin TextField that's inside a Table? 有谁知道如何取消表内的Vaadin TextField的编辑状态? My concrete use case is that I have a table with multiple TextFields in it, that show different values when they are edited as opposed to viewed. 我的具体用例是我有一个包含多个TextField的表,它们在编辑时显示不同的值而不是查看。 The user clicks on a TextField, this makes the field display its editable content. 用户单击TextField,这会使该字段显示其可编辑内容。 If the user changes his mind and wants to stop editing the field (by pressing ESC) the field should cancel any changes the user might have made to its content and revert to displaying its view value. 如果用户改变主意并想要停止编辑字段(通过按ESC),该字段应取消用户可能对其内容所做的任何更改并恢复显示其视图值。

So far I've been able to move the focus to another TextField but this is not what I ultimately want to achieve. 到目前为止,我已经能够将焦点转移到另一个TextField,但这不是我最终想要实现的。 Moving the focus to the parent Table would be acceptable, but doing so programmatically by calling table.focus() does not produce any visible results. 将焦点移动到父表是可以接受的,但通过调用table.focus()以编程方式执行此操作不会产生任何可见结果。

Thanks for your help, 谢谢你的帮助,

Radu 拉杜

要在提交之前还原任何字段的值(包括TextField AbstractField#discard()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM