Filtering on complex objects is not working correct. I am using the example from:
https://blazor.syncfusion.com/documentation/datagrid/columns#complex-data-binding
Title is a property of the mainobject, this works as it should.
Filtering on the subobject will result in 0 Results if you only write a part of the Name to search for.
Searching for "Pea" and Option "Starts with", "Contains", etc... will result in 0 results.
I attach a exampleproject to test it, Last Name and First Name is showing the problem while Title works
The important parts of the code:
<SfGrid DataSource="@Employees" Height="315" AllowFiltering="true">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
<GridColumns>
<GridColumn Field=@nameof(EmployeeData.EmployeeID) HeaderText="EmployeeID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field="Name.FirstName" HeaderText="First Name" Width="150"></GridColumn>
<GridColumn Field="Name.LastName" HeaderText="Last Name" Width="130"></GridColumn>
<GridColumn Field=@nameof(EmployeeData.Title) HeaderText="Title" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public class EmployeeData
{
public int? EmployeeID { get; set; }
public EmployeeName Name { get; set; }
public string Title { get; set; }
}
public class EmployeeName
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public ListEmployees { get; set; }
protected override void OnInitialized()
{
Employees = Enumerable.Range(1, 9).Select(x => new EmployeeData()
{
EmployeeID = x,
Name = new EmployeeName()
{
FirstName = (new string[] { "Nancy", "Andrew", "Janet", "Margaret", "Steven" })[new Random().Next(5)],
LastName = (new string[] { "Davolio", "Fuller", "Leverling", "Peacock", "Buchanan" })[new Random().Next(5)]
},
Title = (new string[] { "Sales Representative", "Vice President, Sales", "Sales Manager",
"Inside Sales Coordinator" })[new Random().Next(4)],
}).ToList();
}
}
Attachment: BlazorApp4_acb23c0f.zip
Hi Marc,
Greetings from Syncfusion support.
We are able to reproduce the reported issue at our end while
using filter in complex column. We are validating the issue further at our end.
We will update further details within two
business days on or before 5 September 2022.
Until then we appreciate your patience.
Regards,
Monisha
Hi Marc,
Sorry for the inconvenience caused.
We are able to reproduce the reported issue when using standalone SfAutoComplete component. So we have forwarded the query to the concern team. We are validating the issue further with high priority at our end. We will update further details within two more business days on or before 07 September 2022.
Until then we appreciate your patience.
Regards,
Monisha
I don't see that I used the standalone sfautocomplete component, but as long as you can reproduce I am fine with that.
Do you have any
Hi Marc,
Thanks for the patience.
We apologize for the delay in getting back to you. We could able to reproduce the reported issue and we are facing complexities in validating the query. we will update further details without any delay within two business days on or before 13 September 2022. Until then we appreciate your patience.
Regards,
Monisha
Hi Marc,
Thanks for the patience.
We have confirmed this as an issue and logged the defect report “Filter does not work properly for complex columns” for the same. Thank you for taking time to report this issue and helping us to improve our product. At Syncfusion, we are committed to fix all validated defects (subject to technological feasibility and Product Development Life Cycle) and this fix will be included in our upcoming patch release which is expected to be rolled out on or before 5th October, 2022.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
https://www.syncfusion.com/feedback/37663/filter-does-not-work-properly-for-complex-columns
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization”
Until then we appreciate your patience.
Regards,
Monisha S
Hi Marc,
Sorry for the inconvenience caused.
Due to some unforeseen circumstances, we could not include the reported issue as promised. So we have planned to include this in our upcoming volume release which is expected to be rolled out on October 18th , 2022.
We will update you once the release is rolled out. Until then we appreciate your patience.
Disclaimer : Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
Regards,
Monisha
Hi Marc,
Sorry for the inconvenience caused.
We are able to reproduce the reported issue at our end and as informed earlier, the reported issue was due to our dependent component. Based on that, we have considered this as a bug and provided the timeline. Later they shared the sample-level workaround to resolve the reported issue. Using that workaround, we have tried to provide the source-level fix to resolve the issue but we could not fix this in our source for the complex column.
We suggest you resolve the reported issue by rendering the AutoComplete component in the FilterTemplate feature of Grid. Refer to the below code example.
|
<SfGrid DataSource="@Employees" ID="AgreementGrid" @ref="AgreementsGrid" Height="400" AllowSorting=true AllowMultiSorting="true" AllowExcelExport="true" AllowFiltering=true> <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings> <GridColumns> <GridColumn Field=@nameof(EmployeeData.EmployeeID) HeaderText="EmployeeID" TextAlign="TextAlign.Right" Width="120"></GridColumn> <GridColumn Field="Name.FirstName" HeaderText="First Name" Width="150"> <FilterTemplate> <SfAutoComplete Placeholder="Select a Value" Autofill="true" @bind-Value="@((context as PredicateModel<string>).Value)" TItem="EmployeeData" TValue="string" DataSource="@(Employees)"> <SfDataManager Json="@Employees" Adaptor="Syncfusion.Blazor.Adaptors.BlazorAdaptor"> </SfDataManager> <AutoCompleteFieldSettings Value="Name.FirstName"></AutoCompleteFieldSettings> <AutoCompleteEvents TValue="string" TItem="EmployeeData" CustomValueSpecifier="@customFirst"></AutoCompleteEvents> </SfAutoComplete> </FilterTemplate> </GridColumn> <GridColumn Field="Name.LastName" HeaderText="Last Name" Width="130"> <FilterTemplate> <SfAutoComplete Placeholder="Select a Value" Autofill="true" @bind-Value="@((context as PredicateModel<string>).Value)" TItem="EmployeeData" TValue="string" DataSource="@(Employees)"> <SfDataManager Json="@Employees" Adaptor="Syncfusion.Blazor.Adaptors.BlazorAdaptor"> </SfDataManager> <AutoCompleteFieldSettings Value="Name.LastName"></AutoCompleteFieldSettings> <AutoCompleteEvents TValue="string" TItem="EmployeeData" CustomValueSpecifier="@customLast"></AutoCompleteEvents> </SfAutoComplete> </FilterTemplate> </GridColumn> <GridColumn Field=@nameof(EmployeeData.Title) HeaderText="Title" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> </GridColumns> </SfGrid>
@code { public void customFirst(CustomValueSpecifierEventArgs<EmployeeData> args) { args.Item = new EmployeeData() { Name = new EmployeeName() { FirstName = args.Text } }; } public void customLast(CustomValueSpecifierEventArgs<EmployeeData> args) { args.Item = new EmployeeData() { Name = new EmployeeName() { LastName = args.Text } }; } |
Please find the sample below:
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BLAZOR~1-2037755105.zip
Kindly get back to us if you further queries.
Regards,
Monisha