What's the type of this property? Not sure also for what is used since there are other properties defined like FilterProperty, SortProperty and GroupProperty and there is also a Template defined.
The data type of ContactId is int
Maybe you should redefine properties for the entire column since this setting is not used for sorting, filtering, grouping and cell value. There is also no Contains() for non strings.
Not quite sure if I understand correctly. If I change this to
<RadzenDataGridColumn TItem="MyData.Models.MyData.Account" FilterProperty="Company" GroupProperty="Company" Groupable="false" Property="Contact" Title="Name">
I do not get an error any more but the results are not filtered.
My model is like this. I show a list of "Account" items in my grid. One of the properties of this class is "Contact" which is of type "Contact". "Contact" has a property named "Company". Contact is included by using "expand" in the OnLoad query.
My goal is to filter over the comany name. With 5.0 this was working without issues. I always assumed that the "Property" of a column does not really matter if I define a custom template that uses what ever fields I want to show. And FilterProperty, GroupProperty and SortProperty are there to pick the specific properties that are being used for those purposes - so no relation to the actual "Property" unless not defined...
Combination or Property and FilterProperty is used in some cases to define sub/collection item property for a collection property:
Maybe you should remove FilterProperty, SortProperty and GroupProperty settings and just leave Property="Contact.Company".
UPDATE:
We also fixed this: DataGrid FilterProperty should be used instead Property if defined ยท radzenhq/radzen-blazor@a2591f7 ยท GitHub
We are back in the game! After the update, it is working again. Thanks a lot for your quick help!
Most things seem to be working now after the fixes you provided. However, one thing that is still mostly not working in my app is the Export controller. I get different types of exceptions, even full crash of the app including a "System.StackOverflowException" in Microsoft.CodeAnalysis.CSharp.dl for a query that looks quite straight forward:
var query = new Query()
{
Filter = $@"{(string.IsNullOrEmpty(gridLicenses.Query.Filter) ? "true" : gridLicenses.Query.Filter)}",
OrderBy = gridLicenses.Query.OrderBy,
Expand = "Account,Account.Contact,Product,Product.ProductType",
Select = "IsActive, Account.AccountNo as AccountNo, Account.Contact.Company as Licensee, Product.Name as ProductName, Product.ProductType as ProductType, DateCreated, DateIssued, DateExpires, Link, Source, Comment"
};
Another exception I got was this one:
InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.AssignmentExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax'.
Radzen.ExpressionSyntaxVisitor<T>+<>c__DisplayClass20_0.<VisitAnonymousObjectCreationExpression>b__0(AnonymousObjectMemberDeclaratorSyntax init)
InvalidOperationException: Invalid selector: AccountNo = it.AccountNo, Contact.Company = it.Contact?.Company, Contact.Firstname = it.Contact?.Firstname, Contact.Lastname = it.Contact?.Lastname, AccountType = it.AccountType?.Name, Language = it.Contact?.Language, Country = it.Contact?.Country, DateCreated = it.DateCreated, BillingType = it.BillingType?.Name, SupportUntil = it.SupportUntil.
System.Linq.Dynamic.Core.DynamicExtensions.Select<T>(IQueryable<T> source, string selector, object[] parameters)
Looks like parsing the queries with the new engine still has some glitches.
Just published update with fix for this, let me know if you still have any exceptions!
Thanks. However, the first issue remians the same - still getting the same exception InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.AssignmentExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax'. while the other example where I posted the query now fully crashes with:
Code 3221225477 (0xc0000005) 'Access violation' terminated.
(using v6.0.12)
Unfortunately without application we will hardly fix this.
Can I sent you the code via a private message or by e-mail?
Yes you can. Upload the code to some cloud storage provider and share a download link with us - either by email to info@radzen.com or private message.
I was able to track down what causes the exception:
Filter = $@"{(string.IsNullOrEmpty(gridData.Query.Filter) ? "true" : gridData.Query.Filter)}",
OrderBy = $"{gridData.Query.OrderBy}",
Expand = "Account,Account.Contact,Product,Product.ProductType",
Select = "IsActive as IsActive, Account.AccountNo as AccountNo, Account.Contact.Company as Company"
If I remove "Account.Contact.Company as Company" from the Select statement, the query works. The problem seems to be that two hierarchy levels. The query is performened on the "Data" entity which has an "Account" Entity which has a "Contact" entity which has the desired "Company" property (a string). Though the Expand statement has both Account and Account.Contact inside, this has no effect. Accessing Account.AccountNo is no problem, but here, there is only one hierarchy level.
Thanks for the details @JustJoe! We will test locally more than two hierarchy levels of sub properties and we will report back.
I was able to replicate the error! Fix will be published before the end of the day!
And another issue just found: I use sorting over two columns (!) in a grid. Here is the OrderBy expression of the Query:
OrderBy = $"x => x.DateProcessed ?? x.DateCreated desc",
DateProcessed and DateCreated are two DateTime properties in my table.
The expression does not cause an error or an exception but the sorting is simply not applied. Looks like the nullish coalescing operator "??" is not handled correctly...
Thanks @JustJoe! We will include fix for this as well!
@JustJoe unfortunately I was not able to replicate such OrderBy expression. Is this manually written or this is result of DataGrid sorting?
This is manually written code which is executed on the OnLoad of the page.
I checked the debug output from VS where I can see the SQL sent to the DB and here there is:
ORDER BY COALESCE([p].[DateProcessed], NULL) DESC
This shows, that DateCreated is not included in the ordering.
I see now. At the moment such OrderBy() expressions are not supported and I'm not sure if we should provide support for this. You can simply change it to:
OrderBy = "DateCreated desc",