Skip to content

Commit fa5a0e8

Browse files
PivotGrid - fix expand icon for parent-child OLAP hierarchies (T1283598)
1 parent 2d07d7a commit fa5a0e8

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,12 @@ class XmlaStore {
529529
|| dimension.hierarchyName !== options[headerName][index + 1]
530530
.hierarchyName
531531
) {
532-
slices.push(`${dimension.dataField}.${this.preparePathValue(value, dimension.dataField)}`);
532+
const { hierarchyName } = dimension;
533+
if (hierarchyName && isString(value) && value.startsWith(`${hierarchyName}.`)) {
534+
slices.push(value);
535+
} else {
536+
slices.push(`${dimension.dataField}.${this.preparePathValue(value, dimension.dataField)}`);
537+
}
533538
}
534539
});
535540
}

packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/store.xmla.tests.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,35 @@ QUnit.module('Hierarchies', stubsEnvironment, () => {
465465
assert.equal(query, 'with set [DX_columns] as NonEmpty({[Product].[Product Categories].[All],[Product].[Product Categories].[Category]}, {[Measures].[Customer Count]}) set [DX_rows] as NonEmpty({Descendants({[Ship Date].[Calendar].[Month].&[2003]&[8]}, [Ship Date].[Calendar].[Date], SELF_AND_BEFORE)}, {[Measures].[Customer Count]}) SELECT CrossJoin([DX_columns],{[Measures].[Customer Count]}) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME, MEMBER_VALUE ON columns,[DX_rows] DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME, MEMBER_VALUE ON rows FROM [Adventure Works] CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS');
466466
});
467467

468+
QUnit.test('T1283598. Hierarchy slice should not duplicate hierarchy prefix when path value is a full unique name', function(assert) {
469+
this.store.load({
470+
columns: [{ dataField: '[Active Month].[Active Month]' }],
471+
rows: [
472+
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
473+
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Sub Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
474+
{ dataField: '[Product].[Product Nbr]' }
475+
],
476+
values: [{ dataField: '[Measures].[Members]', caption: 'Members' }],
477+
headerName: 'rows',
478+
path: [
479+
'[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial]',
480+
'[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group]'
481+
]
482+
});
483+
const query = this.getQuery();
484+
485+
assert.notStrictEqual(
486+
query.indexOf('WHERE ([Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group])'),
487+
-1,
488+
'WHERE slice contains the full unique name once'
489+
);
490+
assert.strictEqual(
491+
query.indexOf('[Product].[Product Purchaser Type].[Purchaser Sub Type].[Product].[Product Purchaser Type]'),
492+
-1,
493+
'WHERE slice does not duplicate the hierarchy prefix'
494+
);
495+
});
496+
468497
QUnit.test('Hierarchy. Expand child when opposite axis expanded on several levels', function(assert) {
469498
this.store.load({
470499
columns: [{

0 commit comments

Comments
 (0)