Hi,
How do I get Excel filter to work on complex object column? e.g. Text Filter "contains" for Cust.Name.First is not showing filtered data correctly
@page "/"
<SfGrid DataSource="@Orders" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="true">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel" />
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
@*<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>*@
<GridColumn Field="Cust.Name.First" HeaderText="Customer Name First" Width="150"></GridColumn>
<GridColumn Field="Cust.Name.Last" HeaderText="Customer Name Last" Width="150"></GridColumn>
<GridColumn Field="Cust.Country" HeaderText="Customer Country" Width="150"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field="Term" HeaderText="Term" Width="150"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public List<Order> Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
Cust = new Customer
{
Name = new FullName
{
First = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Last = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)]
},
Country = (new string[] { "ENGLAND", "IRAN", "USA", "WHALES", "QATAR" })[new Random().Next(5)]
},
//CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
Term = (new string[] { "EXW", "FCA", "FOB", "DAT", "CNF" })[new Random().Next(5)]
}).ToList();
}
public class FullName {
public string First { get; set; }
public string Last { get; set; }
}
public class Customer {
public FullName Name { get; set; }
public string Country { get; set; }
}
public class Order {
public int? OrderID { get; set; }
//public string CustomerID { get; set; }
public Customer Cust { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
public string Term { get; set; }
}
}
Hi Patrick,
Greetings from Syncfusion support.
From your query, we suspect that you want to excel filter the complex column
and based on your sample we’re able to filter the complex column in the
provided sample. Kindly refer the attached video demo of your reference. If we
misunderstood your query, kindly share the vide demo or more details about an
issue. It’ll will be very helpful for us to validate
the reported query at our end and provide the solution as early as possible
Regards,
Sarveswaran PK
Dear Sarveswaran ,
Please see video.
Value in text box disappears after losing focus for complex object. Hence, unable to filter.
Regards,
Patrick
Hi Patrick,
We are currently Validating the reported query at our end and we will update the further details shortly. Until then we appreciate your patience.
Regards,
Naveen Palanivel
Hi Patrick,
Greetings from Syncfusion support.
We have confirmed this as an issue and logged the defect report “ Input character is not maintained when using complex data in AutoComplete ” 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 any of our upcoming patch release.
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.
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,
Sarvesh
Dear Sarvesh,
The link https://www.syncfusion.com/feedback/39819/input-character-is-not-maintained-when-using-complex-data-in-autocomplete shows access denied.
Regards,
Patrick
On the Data tab, in the Sort & Filter group, click Advanced. To filter the listed range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.
Regards,
Peter
Hi Patrick,
Access for the feedback has been given. So, 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.
Feedback link: https://www.syncfusion.com/feedback/39819/input-character-is-not-maintained-when-using-complex-data-in-autocomplete
We will get back to you once the release gets rolled out successfully along with a fix for the reported issue.
Regards,
Sarvesh
Hi Patrick,
We apologize for any inconvenience caused. We attempted to provide a source-level fix but were unable to do so for the complex column.
We recommend resolving the issue by rendering the AutoComplete component in the Filter Template feature of the Grid. You can refer to the code snippet and sample solution for your reference.
@page "/"
@using Syncfusion.Blazor.Grids @using Syncfusion.Blazor.DropDowns
<SfGrid DataSource="@Employees" Height="400" AllowSorting=true AllowMultiSorting="true" AllowExcelExport="true" AllowFiltering=true> <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></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)">
<AutoCompleteFieldSettings Value="Name.FirstName"></AutoCompleteFieldSettings> <AutoCompleteEvents TValue="string" TItem="EmployeeData" CustomValueSpecifier="@FirstName"></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)">
<AutoCompleteFieldSettings Value="Name.LastName"></AutoCompleteFieldSettings> <AutoCompleteEvents TValue="string" TItem="EmployeeData" CustomValueSpecifier="@LastName"></AutoCompleteEvents> </SfAutoComplete> </FilterTemplate> </GridColumn> <GridColumn Field=@nameof(EmployeeData.Title) HeaderText="Title" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> </GridColumns> </SfGrid>
@code { public void FirstName(CustomValueSpecifierEventArgs<EmployeeData> args) { args.Item = new EmployeeData() { Name = new EmployeeName() { FirstName = args.Text } }; } public void LastName(CustomValueSpecifierEventArgs<EmployeeData> args) { args.Item = new EmployeeData() { Name = new EmployeeName() { LastName = args.Text } }; }
public List<EmployeeData> Employees { 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(); }
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; } } } |
Please let us know if you have any further questions or concerns.
Regards,
Sarvesh