How to filter record in pivot table

aggregation-strategy-master.7z (81.6 KB)
Refer to the attached file for my project. I click refresh button but no any effective. Please help to solve the problem. Thanks.


You must call the repaint() method manually to force a PivotTable to update its state, e.g. to obtain new data from the datasource.



I tried to add the sample1PivotTable.repaint() but it was shown as follows.

:app-web:compileJavaC:\Studio_Projects\aggregation-strategy-master\modules\web\src\com\company\sample\web\sample1\ error: cannot find symbol private pivotTable sample1PivotTable;

Please find the enclosed file for the updated program source. (1.8 KB)

First of all, PivotTable is a class and must be written with a capital letter.
Then you need to import the PivotTable class

import com.haulmont.charts.gui.components.pivot.PivotTable;

I added the above statement to pass the compile program. I inputted the correct after the input wrong date test case. The pivot table only shown the total amount.

Updated program: (151 Bytes)

Could you clarify your current problem? You send me an empty controller file without any filtering logic.

Sorry, I attached wrong file. program (2.4 KB)

I expect result as attached file. correct_screen

Now the system shown result as attached file. not_correct_screen

How to fixed the problem ?

If you compare the images above, you will see that in the first one columns and rows are specified and in the second one are not.

If this is the result of invoking the repaint method, then you need to update your CUBA Platform version. See related issue: PL-10563.

Is upgrade CUBA platform to 6.8 ?

The one of 6.8.5, 6.7.12 versions.

I tried to upgrade the platform to 6.7.12 but the result was same.

Could you please attach the final project so that I can review it and find the problem?

Thank you for your support. I uploaded the project for your investigate.

Project file: (367.9 KB)


First of all, you don’t need to add columns and rows every time you refresh the datasource. Anyway, I can’t reproduce the problem above, but I’ve changed you code a little bit in the following ways:

  1. I use the filter element within query, so that if there is no rptDate then the filter is ignored.
<groupDatasource id="sample1sDs"
        <![CDATA[select e from sample$Sample1 e]]>
                <c>e.rptDate = :custom$rptDate</c>
  1. Simplified the screen controller code, because you don’t need to check whatever TextField value is null in case of using query filter.
public class Screen extends AbstractWindow {

    private CollectionDatasource<Sample1, UUID> sample1sDs;

    private TextField filterField;

    private PivotTable sample1PivotTable;

    public void init(Map<String, Object> params) {
        filterField.addValueChangeListener(e -> refresh());

    public void refresh() {
        sample1sDs.refresh(ParamsMap.of("rptDate", filterField.getValue()));

Thanks. The problem is solved.

Do you know how to export pivot table in excel format ?

Unfortunately, there is no export functionality provided by PivotTable. The closest is the TSV Export renderer which renders data as tab separated values.