Possibility to render items in token list as link

In fieldgroups and tables a “relation property” can be easily rendered as link by setting the attribute link=“true”.

It would be nice if items (entities) in a token list can be rendered as links the same way without additional implementation effort.

Hi!

You can implement this using TokenList.ItemClickListener and simple CSS styling.


<tokenList id="demoTokenList"
           caption="Demo"
           datasource="usersDs"
           simple="true"
           stylename="demo-token-links"
           width="200px">
    <lookup>
    </lookup>
    <addButton caption="Add"/>
</tokenList>

CSS styles:


.demo-token-links .c-tokenlist-label-content div.content {
  text-decoration: underline;
  color: $v-focus-color;
}

And set ItemClickListener in a screen controller:


@Inject
private TokenList demoTokenList;

@Override
public void init(Map<String, Object> params) {
    super.init(params);

    demoTokenList.setItemClickListener(item -> {
        showNotification("Demo " + ((Entity) item).getInstanceName());
    });
}

There you will be able to open editor or implement custom business logic.