| 1 |
import { PivotRenderer } from "@web/views/pivot/pivot_renderer"; |
| 2 |
|
| 3 |
|
| 4 |
export class AnalyticPivotRenderer extends PivotRenderer { |
| 5 |
|
| 6 |
/* |
| 7 |
* Override to avoid using incomplete groupByItems |
| 8 |
*/ |
| 9 |
onGroupBySelected({ itemId, optionId }) { |
| 10 |
if (typeof(optionId) === "number") { |
| 11 |
itemId = optionId; |
| 12 |
} |
| 13 |
let searchItems = this.env.searchModel.getSearchItems( |
| 14 |
(searchItem) => |
| 15 |
["groupBy", "dateGroupBy"].includes(searchItem.type) && !searchItem.custom |
| 16 |
) |
| 17 |
searchItems = [...searchItems, ...searchItems.flatMap((f) => f.options).filter((f) => typeof(f?.id) === "number")] |
| 18 |
const { fieldName } = searchItems.find(({ id }) => id === itemId); |
| 19 |
this.model.addGroupBy({ ...this.dropdown.cellInfo, fieldName, interval: optionId }); |
| 20 |
} |
| 21 |
} |