Hi Erick,
Greetings from Syncfusion support.
Query: “how do I get the filtering to find values on that
calculated column?”
We would like to inform you that in DataGrid, data
operations will be performed based on the field values i.e.) the data
operations like sort, search and filter takes place only based on the field
values.
And template is used only for display purpose. From you
shared code we suspect that you are trying to perform filter based on the
template column value. So, it is not feasible to perform filter based on the
templated value.
Instead we suggest you to kindly make calculation in the
code part and assigned it to the specific field. So that we can perform
filtering on the specific field.
Sample: https://blazorplayground.syncfusion.com/embed/VDBfZhNwBBuPzTfg?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5
|
<SfGrid DataSource="@Orders" AllowFiltering="true" AllowPaging="true">
<GridPageSettings PageSize="8"></GridPageSettings>
<GridColumns>
...
</GridColumns>
</SfGrid>
@code {
public List<Order> Orders {
get; set; }
protected override void
OnInitialized()
{
Orders = Enumerable.Range(1, 25).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
ManfCost = 10 * x,
LabCost = 3 * x,
OrderDate = DateTime.Now.AddDays(-x),
}).ToList();
foreach (var order in Orders)
{
order.FinalCost = order.ManfCost + order.LabCost;
}
}
}
|
Please let us know if you have any concerns.
Regards,
Monisha