Vaadin 23 add click listener to TextField component

Viewed 60

Is it possible to add ClickListener to a TextField component? I render a read-only TextField in the Grid column component. The column has expandable details. But when I click on TextField there - nothing happens. With help of ClickListener I plan to expand Grid details programmatically.

1 Answers

Sure you can add any JavaScript listener with this method:

textField.getElement().addEventListener("click", event -> Notification.show("click"));
Related