You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Grid supports accepting a FilteringExpressionsTree with missing logic function. The grid will recreate the logic based on the field it refers to.
However, if such field does not exist in the grid data, condition logic will not be recreated (Expected). Still, the grid will try to call condigion.logic without verifying it does exist
igniteui-angular version: 19.1.4
Steps to reproduce
Add grid
Pass the following filteringExpressionsTree:
grid.advancedFilteringExpressionsTree = JSON.parse('{"filteringOperands":[{"fieldName":"Missing","condition":{"name":"notEmpty","isUnary":true,"iconName":"filter_not_empty"},"conditionName":"notEmpty","ignoreCase":true,"searchVal":null,"searchTree":null}],"operator":0,"returnFields":[],"type":1}')
Grid throws:
cond.logic is not a function
Result
the filtering strategy should return false when trying to find a value in a field, which does not exist. Should try to call the condigion logic function to check a value.
Expected result
Grid should appear empty, because for every record, false would have been returned by the filtering strategy
AdvancedFilteringDialog should still display the filtering expression:
The text was updated successfully, but these errors were encountered:
Alternatives considered:
One suggestion was for the grid to throw an error if it is unable to recreate a condition, as in this case. This would signal to the developer that the filteringExpressionTree contains a field that does not exist in the grid.
However, I believe that not throwing an error and instead returning an expression with an empty condition is the better approach for several reasons:
It allows the application to continue running. The grid will be displayed empty, making it clear to the user what filtering expressions have been applied. This behavior aligns with the expected outcome—when a filtering expression does not match any existing records, the grid naturally returns zero results.
The filteringExpressionsTree and data should be treated as dynamic. Consider a scenario where an application displays data with a certain filter applied. The user retrieves data based on a condition, the data is fetched, and the filter is applied. If the user then fetches new data based on a different condition, the filtering remains unchanged, but the underlying data may be completely different. In such cases, throwing an error would be an unexpected and disruptive behavior.
The grid supports the autoGenerate feature, which accommodates scenarios where each new data assignment may have a different structure. If all other grid features are designed to work dynamically, it would be inconsistent for Filtering to throw, if a certain field does not exist in grid data.
Description
Grid supports accepting a FilteringExpressionsTree with missing logic function. The grid will recreate the logic based on the field it refers to.
However, if such field does not exist in the grid data, condition logic will not be recreated (Expected). Still, the grid will try to call condigion.logic without verifying it does exist
Steps to reproduce
Add grid
Pass the following filteringExpressionsTree:
grid.advancedFilteringExpressionsTree = JSON.parse('{"filteringOperands":[{"fieldName":"Missing","condition":{"name":"notEmpty","isUnary":true,"iconName":"filter_not_empty"},"conditionName":"notEmpty","ignoreCase":true,"searchVal":null,"searchTree":null}],"operator":0,"returnFields":[],"type":1}')
Grid throws:
cond.logic is not a function
Result
the filtering strategy should return false when trying to find a value in a field, which does not exist. Should try to call the condigion logic function to check a value.
Expected result
Grid should appear empty, because for every record, false would have been returned by the filtering strategy
AdvancedFilteringDialog should still display the filtering expression:
The text was updated successfully, but these errors were encountered: