Skip to content

Commit b8af5d9

Browse files
chore(Grid): add suggestions as per comments
1 parent 147308e commit b8af5d9

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

knowledge-base/grid-dynamically-updating-filtermenutemplate-value.md

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: FilterMenuTemplate Not Updating After Dynamic Value Change
2+
title: FilterMenuTemplate Not Updating After Dynamic Value Change
33
description: Learn how to refresh and update the displayed value within a FilterMenuTemplate when its value changes dynamically in Grid for Blazor.
44
type: troubleshooting
55
page_title: Refreshing FilterMenuTemplate to Reflect Dynamic Value Changes in Blazor Grid
66
slug: grid-kb-dynamically-updating-filtermenutemplate-value
7-
tags: grid, blazor, filtermenutemplate, dynamic, update, refresh, value
7+
tags: grid, blazor, filter, filtermenutemplate
88
res_type: kb
99
ticketid: 1677674
1010
---
@@ -22,7 +22,7 @@ ticketid: 1677674
2222

2323
## Description
2424

25-
I have a custom `FilterMenuTemplate` for a column where a slider is shown. Although filtering works as expected, the span within the `FilterMenuTemplate` that is supposed to show the current selected value does not update when the slider value changes.
25+
I have a custom `FilterMenuTemplate` for a column where a slider is shown. Although filtering works as expected, the `<span>` within the `FilterMenuTemplate` that is supposed to show the current selected value does not update when the slider value changes.
2626

2727
## Cause
2828

@@ -51,8 +51,7 @@ To resolve this issue, encapsulate the content of the `FilterMenuTemplate` in a
5151
<GridColumn Field="@(nameof(Product.Name))" Title="Product" Filterable="false" />
5252
<GridColumn Field="@(nameof(Product.Price))">
5353
<FilterMenuTemplate>
54-
<CustomPriceFilter SelectedPrice="@SelectedPrice"
55-
SelectedPriceChanged="@(value => SelectedPrice = value)"
54+
<CustomPriceFilter @bind-SelectedPrice="@SelectedPrice"
5655
Context="context" />
5756
</FilterMenuTemplate>
5857
</GridColumn>
@@ -189,20 +188,19 @@ To resolve this issue, encapsulate the content of the `FilterMenuTemplate` in a
189188
Context.FilterDescriptor.FilterDescriptors.Clear();
190189
Context.FilterDescriptor.FilterDescriptors.Add(new FilterDescriptor(nameof(Product.Price), FilterOperator.IsGreaterThanOrEqualTo, newValue));
191190
await SelectedPriceChanged.InvokeAsync(newValue);
192-
// await Context.FilterAsync();
193191
}
194192
}
195193
`````
196194
`````RAZOR Product.cs
197195
public class Product
198-
{
199-
public int Id { get; set; }
200-
public string? Name { get; set; }
201-
public string Size { get; set; }
202-
public double Price { get; set; }
203-
}
196+
{
197+
public int Id { get; set; }
198+
public string? Name { get; set; }
199+
public string? Size { get; set; }
200+
public double Price { get; set; }
201+
}
204202
`````
205203
## See Also
206204

207-
- [Grid Overview](slug:grid-overview)
205+
- [Grid Filter Templates](slug:grid-templates-filter)
208206
- [Filtering in Grid](slug:components/grid/filtering)

0 commit comments

Comments
 (0)