Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Groups below the first grouping level were missing labels #2364

Merged
merged 1 commit into from Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -39,7 +39,7 @@ export interface IGroupItemData {
childRows: any[][];
columnId: string;
columnValue: string;
columnDisplayValue: string;
getColumnDisplayValue: () => string;
groupLabel: string;
parent: IGroupTreeNode | undefined;
rowCount: number;
Expand Down Expand Up @@ -69,7 +69,7 @@ export class ClientSideGroupItem implements IClientSideGroupItemData, IGroupTree
groupLabel: string = null as any;
parent: IGroupTreeNode | undefined = null as any;
rowCount: number = null as any;
columnDisplayValue: string = null as any;
getColumnDisplayValue: () => string = null as any;
aggregations: IAggregation[] | undefined = undefined;
grouper: IGrouper = null as any;
groupFilters: string[] = [];
Expand Down Expand Up @@ -158,7 +158,7 @@ export class ServerSideGroupItem implements IGroupTreeNode {
groupLabel: string = null as any;
parent: IGroupTreeNode | undefined = null as any;
rowCount: number = null as any;
columnDisplayValue: string = null as any;
getColumnDisplayValue: () => string = null as any;
aggregations: IAggregation[] | undefined = undefined;
grouper: IGrouper = null as any;
scrollLoader: InfiniteScrollLoader;
Expand Down
Expand Up @@ -30,7 +30,7 @@ export class TableGroupRow implements IGroupRow {
}

get columnValue(): string {
return this.sourceGroup.columnDisplayValue;
return this.sourceGroup.getColumnDisplayValue();
}

get isExpanded(): boolean {
Expand Down
Expand Up @@ -47,7 +47,7 @@ export interface IGroupTreeNode {
isExpanded: boolean;
rowCount: number;
columnValue: string;
columnDisplayValue: string;
getColumnDisplayValue: () => string;
aggregations: IAggregation[] | undefined;
allParents: IGroupTreeNode[];

Expand Down
8 changes: 4 additions & 4 deletions frontend-html/src/model/entities/ClientSideGrouper.ts
Expand Up @@ -84,7 +84,7 @@ export class ClientSideGrouper implements IGrouper {

loadRecursively(groups: IGroupTreeNode[]) {
for (let group of groups) {
if (this.expandedGroupDisplayValues.has(group.columnDisplayValue)) {
if (this.expandedGroupDisplayValues.has(group.getColumnDisplayValue())) {
group.isExpanded = true;
this.loadChildrenInternal(group);
this.loadRecursively(group.childGroups);
Expand All @@ -94,9 +94,9 @@ export class ClientSideGrouper implements IGrouper {

expansionListener(item: ClientSideGroupItem) {
if (item.isExpanded) {
this.expandedGroupDisplayValues.add(item.columnDisplayValue);
this.expandedGroupDisplayValues.add(item.getColumnDisplayValue());
} else {
this.expandedGroupDisplayValues.delete(item.columnDisplayValue);
this.expandedGroupDisplayValues.delete(item.getColumnDisplayValue());
}
}

Expand All @@ -123,7 +123,7 @@ export class ClientSideGrouper implements IGrouper {
rowCount: groupData.rows.length,
parent: parent,
columnValue: groupData.label,
columnDisplayValue: property ? dataTable.resolveCellText(property, groupData.label) : groupData.label,
getColumnDisplayValue: () => property ? dataTable.resolveCellText(property, groupData.label) : groupData.label,
aggregations: this.calcAggregations(groupData.rows),
grouper: this,
expansionListener: this.expansionListener.bind(this)
Expand Down
6 changes: 3 additions & 3 deletions frontend-html/src/model/entities/ServerSideGrouper.ts
Expand Up @@ -77,7 +77,7 @@ export class ServerSideGrouper implements IGrouper {
}
const expandedGroupDisplayValues = this.allGroups
.filter(group => group.isExpanded)
.map(group => group.columnDisplayValue)
.map(group => group.getColumnDisplayValue())
const dataView = getDataView(this);
const property = getDataTable(this).getPropertyById(firstGroupingColumn.columnId);
const lookupId = property && property.lookup && property.lookup.lookupId;
Expand All @@ -89,7 +89,7 @@ export class ServerSideGrouper implements IGrouper {

private*loadAndExpandChildren(childGroups: IGroupTreeNode[], expandedGroupDisplayValues: string[]): Generator {
for (const group of childGroups) {
if (expandedGroupDisplayValues.includes(group.columnDisplayValue)) {
if (expandedGroupDisplayValues.includes(group.getColumnDisplayValue())) {
group.isExpanded = true;
yield*this.loadChildren(group);
yield*this.loadAndExpandChildren(group.childGroups, expandedGroupDisplayValues)
Expand Down Expand Up @@ -214,7 +214,7 @@ export class ServerSideGrouper implements IGrouper {
rowCount: groupDataItem["groupCount"] as number,
parent: parent,
columnValue: groupData.value,
columnDisplayValue: groupData.label,
getColumnDisplayValue: () => groupData.label,
aggregations: parseAggregations(groupDataItem["aggregations"]),
groupingUnit: groupingSettings.groupingUnit,
grouper: this,
Expand Down
3 changes: 2 additions & 1 deletion frontend-html/src/modules/Lookup/LookupResolver.ts
Expand Up @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.
*/

import { action, createAtom, IAtom } from "mobx";
import { action, createAtom, IAtom, observable } from "mobx";
import _ from "lodash";
import { LookupCacheIndividual } from "./LookupCacheIndividual";
import { ILookupIndividualResultListenerArgs, LookupLoaderIndividual, } from "./LookupLoaderIndividual";
Expand All @@ -27,6 +27,7 @@ export class LookupResolver {
constructor(private cache: LookupCacheIndividual, private loader: LookupLoaderIndividual) {
}

@observable
resolved = new Map<any, any>();
atoms = new Map<any, IAtom>();

Expand Down