ShowPivot table action does not support multitenancy

Show Pivot action of table showing data from all tenant.

Secondly can I limit columns in pivot action.

How to solve this.




ShowPivotAction provides API for including and excluding properties.

You can use withIncludedProperties() to show specific properties or withExcludedProperties() to exclude.

I am using following code to show pivot table, but this is giving nullpointexception

    private void onInit(InitEvent event) {
        ShowPivotAction showPivotAction = new ShowPivotAction(complianceMonitoringsTable);

Am I missing something?



ShowPivotAction does not support new data containers. You can use it only in old screens with data sources.

Since v7.0.8 it is possible to use new ShowPivotAction that support data containers.
Please note:
com.haulmont.charts.gui.components.action.ShowPivotAction - for data sources
com.haulmont.charts.gui.components.action.list.ShowPivotAction - for data containers

And they are both provide the same API.

Hot to use new ShowPivotAction

In the layout you can add it to the table by defining action:

<groupTable id="customersTable" dataContainer="customersDc">
        <action id="showPivot" type="pivot_showPivot"/>
    <buttonsPanel id="buttonsPanel"
        <button id="showPivotBtn" action="customersTable.showPivot"/>

In this case ShowPivotAction will show all available properties in pivot table according to his action rules.

If you want to configure your ShowPivotAction you can subscribe to given event and use PivotScreenBuilder:

private GroupTable<Customer> customersTable;

private void onCustomersTableShowPivot(Action.ActionPerformedEvent event) {
    PivotScreenBuilder builder = getBeanLocator().getPrototype(PivotScreenBuilder.NAME, customersTable);

The full example: (82.5 KB)

Thanks @Pinyazhin,

It works but with limitation-
As per document the showpivotaction shows pivot for selected data or if nothing selected then for all data.

Code suggested by you will show pivot for selected items only and
show for all items.

should I have to code for original behavior?



It depends on your requirements and business logic.