Hi!
I have a problem displaying a list of DTO’s in a table. My DTO (simplified):
@Getter
@Setter
@JmixEntity
public class PriceReportRowDTO {
@JmixId
UUID id;
@InstanceName
private String name;
// other fields...
}
Data is fetched with a custom repository, so I use a load delegate in my screen to get the data. The screen is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window"
caption="msg://priceReportScreen.caption">
<data readOnly="true">
<collection id="priceReportDc" class="com.advance.agent.entity.PriceReportRowDTO">
<loader id="priceReportDl"/>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
</facets>
<layout>
<table id="productsTable"
width="100%"
dataContainer="priceReportDc">
<columns>
<column id="name"/>
</columns>
</table>
</layout>
</window>
Controller:
@UiController("PriceReportScreen")
@UiDescriptor("price-report-screen.xml")
public class PriceReportScreen extends Screen {
@Autowired private PriceReportRepository priceReportRepository;
@Install(to = "priceReportDl", target = Target.DATA_LOADER)
protected List<PriceReportRowDTO> priceReportDlDelegate(LoadContext<PriceReportRowDTO> loadContext) {
return priceReportRepository.getReportRows();
}
}
After all I get an empty table, although priceReportDc has all the data after the screen is loaded. What am I doing wrong?
I’ve also tried to load another object (not a DTO) using a query in the xml and that worked well with the same code.
UPD: actually I found that the problem is not in the delegate but in my DTO class. If I return a list of entities from a load delegate, there is no problem.