Description
When calling the "getState" method on the grid state directive, the sorting expressions are mutated e.g. the strategy property gets deleted.
This can lead to incorrect sorting when e.g. subscribing to the sortingExpressionsChange and (later) applying the value using the grid sort method.
- igniteui-angular version: 21.1.3
- browser: 146.0.7680.165
Steps to reproduce
- Set a sorting expression with the
strategy property set
- Subscribe to the
sortingExpressionsChange
- Call the
getState method
- e.g. console log the sorting expressions
Result
The `strategy property is missing.
Expected result
The strategy property should still be set
When querying claude about the issue it pointed to this location in the code. I did not look further into it but maybe it helps...
sorting: {
getFeatureState: (context: IgxGridStateBaseDirective): IGridState => {
const sortingState = context.currGrid.sortingExpressions; // ← returns the LIVE internal array
sortingState.forEach(s => {
delete s.strategy; // ← MUTATES the real ISortingExpression objects
delete s.owner; // ← MUTATES the real ISortingExpression objects
});
return { sorting: sortingState };
},
...
}
It looks like other properties like "filtering" are also affected.
Description
When calling the "getState" method on the grid state directive, the sorting expressions are mutated e.g. the
strategyproperty gets deleted.This can lead to incorrect sorting when e.g. subscribing to the
sortingExpressionsChangeand (later) applying the value using the gridsortmethod.Steps to reproduce
strategyproperty setsortingExpressionsChangegetStatemethodResult
The `strategy property is missing.
Expected result
The
strategyproperty should still be setWhen querying claude about the issue it pointed to this location in the code. I did not look further into it but maybe it helps...
It looks like other properties like "filtering" are also affected.