From 5794b845f8aa07dd0aeb8a8db3ce7303e7ca5a03 Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Mon, 2 Sep 2024 08:30:52 +0400 Subject: [PATCH] review fix --- .../pivot_grid/xmla_store/m_xmla_store.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index 2c4952174c70..dfd32ef16b55 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -668,18 +668,20 @@ const XmlaStore = Class.inherit((function () { return cells; } - function preparePathValue(pathValue, dataField?) { - if (pathValue) { - const shouldWrapPathValue = isString(pathValue) && ( - pathValue.includes('&') || pathValue.startsWith(`${dataField}.`) - ); - pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`; - - if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { - pathValue = pathValue.slice(dataField.length + 1, pathValue.length); - } + function preparePathValue(pathValue, dataField?): string | undefined { + if (!pathValue) { + return undefined; } - return pathValue; + if (!isString(pathValue)) { + return `[${pathValue}]`; + } + + const isStartedWithDataField = dataField && pathValue.startsWith(`${dataField}.`); + const preparedPath = isStartedWithDataField + ? pathValue.slice(dataField.length + 1, pathValue.length) + : `[${pathValue}]`; + + return preparedPath; } function getItem(hash, name, member?, index?) {