documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Update PivotTable examples

Open lovtsovaik opened this issue 5 years ago • 0 comments

Environment

  • Documentation version: 7.2
  • Part of the documentation: Charts
  • Existing page: https://doc.cuba-platform.com/charts-7.2/charts.html#pivotTable

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

lovtsovaik avatar Nov 02 '20 12:11 lovtsovaik