-
Notifications
You must be signed in to change notification settings - Fork 612
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
PivotGrid - Column expands after datasource reload - T1246608 #28884
base: 25_1
Are you sure you want to change the base?
PivotGrid - Column expands after datasource reload - T1246608 #28884
Conversation
ca2ca00
to
4f3d0bb
Compare
loadOptions[expandedPathOptionName] = [[2010], [2010, 1]]; | ||
store.load(loadOptions).done(function() { | ||
assert.deepEqual(actualFilter, [['date', '=', 2010]], 'rows count'); | ||
assert.deepEqual(actualFilter, ['date', '=', 2010], 'rows count'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was to check if filter duplicates. Like [['date', '=', '2010'], 'or', ['date', '=', '2010']]
. After my fix, the nesting structure is changed a little bit, but no duplicate filter occur, so that's ok
store.load(loadOptions).done(function() { | ||
assert.deepEqual(actualFilter, [[['date1', '=', 2010]], 'and', [['date2', '=', 2010]]], 'rows count'); | ||
assert.deepEqual(actualFilter, [['date1', '=', 2010], 'and', ['date2', '=', 2010]], 'rows count'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as this comment: https://github.com/DevExpress/DevExtreme/pull/28884/files#r1941724159
@@ -1740,7 +1740,7 @@ QUnit.module('Expanding items', moduleConfig, () => { | |||
{ dataField: 'ShipRegion' }, | |||
{ dataField: 'ShipCity' } | |||
], | |||
rowExpandedPaths: [['USA', 'AK']], | |||
rowExpandedPaths: [['USA'], ['USA', 'AK']], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rowExpandedPaths: [['USA', 'AK']]
is an impossible expanded path in pivotgrid. To open 'AK', you have to first open 'US', so the expandedPaths must be at least this: [['USA'], ['USA', 'AK']]
rows, | ||
filters: filters.concat(getExpandedPathSliceFilter(options, 'columns', j, firstCollapsedColumnIndex)).concat(rowFilterByExpandedPaths), | ||
filters: commonFilters, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requestOptions.filters
is an array of fields
. getExpandedPathSliceFilter
was extending fields with properties field.filterValues
and 'field.filterType='include'
. field.filterValues
is an array of values of the field that we want to request. Later this array is transformed into a filter expression: https://github.com/DevExpress/DevExtreme/pull/28884/files#diff-b5d7b2b7d8a915d9d730cc006e8643b086ab02749e516b8cf9d46ec2dd1bd121L174
But now filters for fields are directly generated in the form of filter expression (aka [['field', '=', 'some value']]
) and then just merged with options.filters
: https://github.com/DevExpress/DevExtreme/pull/28884/files#diff-b5d7b2b7d8a915d9d730cc006e8643b086ab02749e516b8cf9d46ec2dd1bd121R205-R207
4f3d0bb
to
d2f7078
Compare
d2f7078
to
b550e1e
Compare
return 0; | ||
} | ||
|
||
function getExpandedPathsFilterExprByLevel(options, axis, level) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function fixes the issue. Before getExpandedPathSliceFilter was used to calculate filters.
Now the algorithm for calculating filters is different. getExpandedPathSliceFilter
was extending fields
array, adding filterValues
and filterType=include
to it. filterValues
was an array which contained values of the columns that were expanded.
E.g. given this expandedPaths: [[2017], [2017, 1], [2018], [2018, 2]]. The result for level=2
will be this:
[
{ dataField: 'Year', filterValues: [2017, 2018], filterType: 'include' },
{ dataField: 'Quarter', filterValues: [1, 2], filterType: 'include' }
]
Later these fields will be converted into this filter expression:
[
[['Year', '=', '2017'], 'or', ['Year', '=', '2018]],
'and',
[['Quarter', '=', 1], 'or', ['Quarter', '=', 2]]
]
The problem with the resulted filter expression is that the data for the Quarter 2 of 2017 will be loaded (it matches the filter).
The new function, getExpandedPathsFilterExprByLevel
, uses different algorithm and the resulting filter expression for the same expandedPaths for level=2
will be:
[
[['Year', '=', 1996], 'and', ['Month', '=', 1]],
'or',
[['Year', '=', 1997], 'and', ['Month', '=', 2]]
]
P.S. level is the level of nesting. PivotGrid has multi-level columns and rows. For each row level and column level a separate request is created.
No description provided.