In my Vaadin application, there are client-side span
-elements that do not have a server-side representation through components. These elements are generated by a component from the Vaadin Directory.
For my use case, I need to listen to the user clicking on such a span
element, then get a certain data
attribute from the element and do something with it in Java server-side.
Is there a way to setup the click listener, add the event data to it and then do something server-side with it using native Vaadin and without creating a fork of the component from the Vaadin Directory?
These span
elements have an unique class name, so I can use document.getElementsByClassName
to get all of them client-side. I found threads like this that describe how you can add a JavaScript listener to the element, which I could do executing JavaScript from the server changing the client, but how would I react server-side to the event and then do something with it?
In Vaadin you can work with DOMEvents as described here, but don't I need a component server-side whose element I can grab to do this?