Is it possible to make the Link Component data aware?
I would like to change the URL based on a URL stored as an entity.
Example:
Some Link
Is it possible to make the Link Component data aware?
I would like to change the URL based on a URL stored as an entity.
Example:
Some Link
Is it possible to make the Link Component data aware? I would like to change the URL based on a URL stored as an entity.
Example:
<a href="{value of property in entity}" target="_blank"> some link</a>
You can implement this behaviour using ItemPropertyChangeListener on you datasource:
@Inject
protected Datasource<User> userDs;
@Inject
protected Link userProfileLink;
...
@Override
public void init(Map<String, Object> params) {
super.init(params);
userDs.addItemPropertyChangeListener(e -> {
if ("position".equals(e.getProperty())) {
userProfileLink.setTarget((String) e.getValue());
}
});
}
Thanks!