[PR #1347] [MERGED] Add base type to filter array #2685

Closed
opened 2026-01-29 18:20:00 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/radzenhq/radzen-blazor/pull/1347
Author: @paulo-rico
Created: 1/29/2024
Status: Merged
Merged: 1/29/2024
Merged by: @enchev

Base: masterHead: master


📝 Commits (1)

  • 0228e44 Add base type to filter array

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 Radzen.Blazor/QueryableExtension.cs (+4 -2)

📄 Description

After successfully creating a custom filter on DataGridColumn that was a reference to a related table, I then attempted to Export to CSV. Received this error -

InvalidOperationException: No generic method 'Contains' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.

This is the filter - SupplierRef = 18 and (new []{37}).Contains(CategoryRef)

After debugging, it turned out that my column (long [Int64]) was being declared as an array in the filter without a type, and it appeared that linq was inferring from the data, an int datatype. There is no Contains method for an integer datatype.

So I've created a baseType string variable that gets the type of the IEnumerable that has been passed to column.FilterPropertyType. I then include that in the filter array declaration.

Definitely needs a keen eye to look over this. I haven't tested it with any other data type than Int64.
My initial thoughts are that it's only the int / long confusion that causes this.

Paul


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/radzenhq/radzen-blazor/pull/1347 **Author:** [@paulo-rico](https://github.com/paulo-rico) **Created:** 1/29/2024 **Status:** ✅ Merged **Merged:** 1/29/2024 **Merged by:** [@enchev](https://github.com/enchev) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`0228e44`](https://github.com/radzenhq/radzen-blazor/commit/0228e449198028375e646e361e8adaa484bb3b64) Add base type to filter array ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `Radzen.Blazor/QueryableExtension.cs` (+4 -2) </details> ### 📄 Description After successfully creating a custom filter on DataGridColumn that was a reference to a related table, I then attempted to Export to CSV. Received this error - `InvalidOperationException: No generic method 'Contains' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. ` This is the filter - `SupplierRef = 18 and (new []{37}).Contains(CategoryRef)` After debugging, it turned out that my column `(long [Int64])` was being declared as an array in the filter without a type, and it appeared that linq was inferring from the data, an `int` datatype. There is no `Contains` method for an integer datatype. So I've created a baseType string variable that gets the type of the IEnumerable that has been passed to `column.FilterPropertyType`. I then include that in the filter array declaration. Definitely needs a keen eye to look over this. I haven't tested it with any other data type than `Int64`. My initial thoughts are that it's only the `int / long` confusion that causes this. Paul --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 18:20:00 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#2685