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
Describe the bug
When applying the filter "isNull" on a nullable text column, no item is returned.
This issue happens even if, when no filter is applied on this column, items with a null value on this column are displayed.
To Reproduce
This behavior can be reproduced on the autogenerated page on the gridBlazor demo.
Steps to reproduce the behavior:
Click on the "ship name" column to order the grid by ship name, ascending
Check that the grid contains items with a null ship name
Apply a "is Null" filter on the "ship name" column
See that no item is diplayed on the grid
Expected behavior
When the grid displays data with a null value on a text column, we expect to see data when applying an "is Null" filter on this column.
But the grid is empty when applying such a filter.
Screenshots
Items with null values for the "ship name" column are displayed on the grid
When applying an "is null" filter on the same column, no items are shown :
Additional context
This issue originates in the way filters are managed in the DefaultColumnFilter.cs class. When applying an "is null" filter on a text column, the sql generated by the Entity Framework to filter data will be as follows :
SELECT [o].[OrderID], [o].[CustomerID], ...
FROM [Orders] AS [o]
WHERE ([o].[ShipRegion] IS NOT NULL) ANDUPPER([o].[ShipRegion]) = N''
This filter only returns items whose value for the filtered column is an empty, not null string. This is a problem as we would also like to fecth items with a null string.
In order to return data with a null string and data with an empty string for the filtered column, the where clause should be as follows :
WHERE ([o].[ShipRegion] IS NULL) ORUPPER([o].[ShipRegion]) = N''
Bug fix
I forked this repository and am currently trying to fix the issue. I will issue a pull request as soon as I find a fix.
The text was updated successfully, but these errors were encountered:
I also found that, when applying a not equals filter on a text column, items who have a null string as a value for the filtered column wont be taken in account and wont be displayed. Even if their value is different to the filter's value, as they are null.
Describe the bug
When applying the filter "isNull" on a nullable text column, no item is returned.
This issue happens even if, when no filter is applied on this column, items with a null value on this column are displayed.
To Reproduce
This behavior can be reproduced on the autogenerated page on the gridBlazor demo.
Steps to reproduce the behavior:
Expected behavior
When the grid displays data with a null value on a text column, we expect to see data when applying an "is Null" filter on this column.
But the grid is empty when applying such a filter.
Screenshots
Items with null values for the "ship name" column are displayed on the grid
When applying an "is null" filter on the same column, no items are shown :
Additional context
This issue originates in the way filters are managed in the DefaultColumnFilter.cs class. When applying an "is null" filter on a text column, the sql generated by the Entity Framework to filter data will be as follows :
This filter only returns items whose value for the filtered column is an empty, not null string. This is a problem as we would also like to fecth items with a null string.
In order to return data with a null string and data with an empty string for the filtered column, the where clause should be as follows :
Bug fix
I forked this repository and am currently trying to fix the issue. I will issue a pull request as soon as I find a fix.
The text was updated successfully, but these errors were encountered: