Skip to content

Update PivotTable examples #765

@lovtsovaik

Description

@lovtsovaik

Environment

Description of the bug or enhancement

§4.1.3 Editable PivotTable
The error in code:

    <chart:aggregations default="COUNT">
        <chart:aggregation caption="Count"/>
        <chart:aggregation mode="SUM_OVER_SUM"/>
    </chart:aggregations>

Should be replaced with

    <chart:aggregations default="COUNT">
        <chart:aggregation mode="COUNT"/>
        <chart:aggregation mode="SUM_OVER_SUM"/>
    </chart:aggregations>

because the mode attribute contains possibly options, and the default attribute should be one of them. Otherwise, the opened table is empty and the default parameter is ignored. This can also be added to the documentation text.

§4.3 Using ShowPivotAction
There is not enough information to understand how to use the action.

It needs to clarify that ShowPivotAction should be imported as
com.haulmont.charts.gui.components.action.list.ShowPivotAction, not as com.haulmont.charts.gui.components.action.ShowPivotAction (old implementation)

Also update and expand the example

ShowPivotAction showPivotAction = new ShowPivotAction(tipsGroupTable);
exportButton.setAction(showPivotAction);

to

@Subscribe
public void onInit(InitEvent event) {
    ShowPivotAction showPivotAction = actions.create(ShowPivotAction.class);
    showPivotAction.setTarget(tipsTable);
    defaultShowPivotBtn.setAction(showPivotAction);
}

It would be helpful to clarify how to get the components that extend ListComponent.

@Inject
private GroupTable<TipInfo> tipsTable;

Add the good example link https://demo10.cuba-platform.com/sampler/#main/3/sample?id=pivot-table-show-pivot-action

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions