I am using a keyValueCollection element to provide data to a groupTable.
However when I click on the “Export” button (in order to export to Excel) and select “All Rows”, I get the following error:
RuntimeException: Cannot export all rows. Data loader must be an instance of CollectionLoader.
Here is my code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fragment xmlns="http://jmix.io/schema/ui/fragment"
xmlns:c="http://jmix.io/schema/ui/jpql-condition">
<data readOnly="true">
<keyValueCollection id="dataDc">
<loader id="dataDl">
<query>
<![CDATA[select o.datePicked, su.name, p.name, s.name,
sum(o.returnNoOfCases),
sum(pl.noOfOrders),
count(distinct o.issuedYyyymmdd),
sum(o.minsTaken),
CASE WHEN sum(o.minsTaken) = 0 THEN 0 ELSE sum(o.returnNoOfCases) / (sum(o.minsTaken) / 60.0) END
from pnl_PickListAssignment o
left join o.pickList pl
left join o.picker p
left join o.picker.shift s
left join o.picker.supervisor su
where o.returnNoOfCases > 0
group by o.datePicked, su.name, p.name, s.name]]>
<condition>
<and>
<c:jpql>
<c:where><![CDATA[o.datePicked >= :startDate]]></c:where>
</c:jpql>
<c:jpql>
<c:where><![CDATA[o.datePicked <= :endDate]]></c:where>
</c:jpql>
<c:jpql>
<c:where><![CDATA[o.picker = :picker]]></c:where>
</c:jpql>
<c:jpql>
<c:where><![CDATA[o.picker.shift = :shift]]></c:where>
</c:jpql>
<c:jpql>
<c:where><![CDATA[o.picker.supervisor = :supervisor]]></c:where>
</c:jpql>
</and>
</condition>
</query>
</loader>
<properties>
<property name="date" datatype="date"/>
<property name="supervisor" datatype="string"/>
<property name="picker" datatype="string"/>
<property name="shift" datatype="string"/>
<property name="noOfCases" datatype="int"/>
<property name="noOfOrders" datatype="int"/>
<property name="days" datatype="int"/>
<property name="minsTaken" datatype="int"/>
<property name="casesPerHr" datatype="decimal"/>
</properties>
</keyValueCollection>
<collection id="pickersDc" class="com.company.pickandload.entity.Employee">
<fetchPlan extends="_base"/>
<loader id="pickersDl">
<query>
<![CDATA[select e from pnl_Employee e where (e.isPicker = true)
order by e.name]]>
</query>
</loader>
</collection>
<collection id="shiftsDc" class="com.company.pickandload.entity.Shift">
<fetchPlan extends="_base"/>
<loader id="shiftsDl">
<query>
<![CDATA[select e from pnl_Shift e order by e.name]]>
</query>
</loader>
</collection>
<collection id="supervisorsDc" class="com.company.pickandload.entity.Employee">
<fetchPlan extends="_base"/>
<loader id="supervisorsDl">
<query>
<![CDATA[select e from pnl_Employee e
where (e.isPickSupervisor = true) or (e.isLoadSupervisor = true)
order by e.name]]>
</query>
</loader>
</collection>
</data>
<layout expand="dataTable" spacing="true">
<groupBox>
<flowBox spacing="true">
<dateField id="startDateField" caption="Starting date" datatype="date" dateFormat="yyyy-MM-dd"/>
<dateField id="endDateField" caption="Ending date" datatype="date" dateFormat="yyyy-MM-dd"/>
<entityComboBox id="pickerField" caption="Picker" optionsContainer="pickersDc" >
<actions>
<action id="entityClear" type="entity_clear"/>
</actions>
</entityComboBox>
</flowBox>
<flowBox spacing="true">
<entityComboBox id="supervisorField" caption="Supervisor" optionsContainer="supervisorsDc" >
<actions>
<action id="entityClear" type="entity_clear"/>
</actions>
</entityComboBox>
<entityComboBox id="shiftField" optionsContainer="shiftsDc" caption="Shift" width="200">
<actions>
<action id="entityClear" type="entity_clear"/>
</actions>
</entityComboBox>
<button id="searchBtn" caption="Search" icon="SEARCH" stylename="primary"/>
<button id="clearBtn" caption="Clear"/>
</flowBox>
</groupBox>
<groupTable id="dataTable" width="100%" emptyStateMessage="No records found"
dataContainer="dataDc" reorderingAllowed="true" sortable="true">
<actions>
<action id="excelExport" type="excelExport" icon="EXCEL_ACTION"/>
</actions>
<columns>
<column id="date" caption="Date"/>
<column id="picker" caption="Picker"/>
<column id="shift" caption="Shift"/>
<column id="supervisor" caption="Supervisor"/>
<column id="days" align="RIGHT" caption="Days"/>
<column id="noOfCases" align="RIGHT" caption="Cases"/>
<column id="noOfOrders" align="RIGHT" caption="Orders"/>
<column id="minsTaken" align="RIGHT" caption="Mins Taken"/>
<column id="casesPerHr" align="RIGHT" caption="Cases/hr">
<formatter>
<number format="#,###0.00"/>
</formatter>
</column>
</columns>
<simplePagination/>
<buttonsPanel id="buttonsPanel" alwaysVisible="true">
<button id="excelBtn" action="dataTable.excelExport"/>
</buttonsPanel>
</groupTable>
</layout>
</fragment>
Is there a solution for this ?