Closed glebfox closed 3 weeks ago
Custom renderer markup in XML:
<virtualList itemsContainer="usersDc">
<renderer>
<vbox>
<button id="rendererButton"/>
<textField property="username"/>
</vbox>
</renderer>
</virtualList>
Declarative handlers for components inside:
@Supply(to = "virtualList.@renderer.rendererButton", subject = "clickListener")
public ComponentEventListener<ClickEvent<JmixButton>> onRendererButtonClick(User item) {
return clickEvent -> {
item.doSomething();
};
}
Tested on: Jmix version: 2.4.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6859-242
Components like
DataGrid
,ComboBox
,VirtualList
support renderers to change visual appearance of their columns/list. Currently, renderer can be defined only in Controller code.It'd be convenient to be able to define renderer in XML. One of the options is to create a composite component and use it as a renderer in XML.
Related issues: https://github.com/jmix-framework/jmix/issues/2707 https://github.com/jmix-framework/jmix/issues/841