Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
call vaadin component from javascript
Is it possible to call a function on a Vaadin component from javascript?
I have a Vaadin Label displaying html content. This html content contains links like: <a href="#" onclick="javascript:dosomething()">Link</a>
When the link is clicked, the dosomething function should select an item in a Vaadin Tree object.
Is this possible ahd how to do this, or is there another way to achieve this, by using a component other than Label, ...?
Suggestions are welcome !
Rgds,
Annelies
The client-side in Vaadin is created in GWT. It is possible to publish API from client-side widgets to JavaScript. In practice this is rarely needed.
If your need is just to add a link that selects a row in a Vaadin table, why not just use Link-style in button. See http://demo.vaadin.com/sampler/#ButtonLink for an example.
I have considered the use of a link style button, but since the html label is the complete content of a page (not just one link), I don't know how to display the other html content.
E.g.
This is what I put in my label at the moment:
<p>This is some content. And here is my <a href="#" onclick="javascript:doSomething">link</a></p>
I can display the a-tag as a link style button, but how can I display the rest of the html?
Hi,
It sounds like one possible solution in your case would be to set the fragment - i.e <a href="#itemX">select itemX</a></p>, then 'catch' that on the server using the UriFragmentUtility.
Best Regards,
Marc
Do you know if the UriFragmentUtility can also be used in a portal application?
Update: I tried it out and it works perfectly. Thanks a lot for your help !