File tree 1 file changed +10
-4
lines changed
components/grid/templates
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -212,10 +212,10 @@ This custom filter menu lets you choose more than one option to match against th
212
212
@foreach (var size in Sizes)
213
213
{
214
214
<div>
215
- <TelerikCheckBox Value="@(CheckedSizes.Contains( size))"
216
- TValue="bool"
217
- ValueChanged="@((value) => UpdateCheckedSizes(value, size))"
218
- Id="@($"size_{size}")">
215
+ <TelerikCheckBox Value="@(IsCheckboxInCurrentFilter(context.FilterDescriptor, size))"
216
+ TValue="bool"
217
+ ValueChanged="@((value) => UpdateCheckedSizes(value, size))"
218
+ Id="@($"size_{size}")">
219
219
</TelerikCheckBox>
220
220
<label for="@($"size_{size}")">
221
221
@size
@@ -233,6 +233,12 @@ This custom filter menu lets you choose more than one option to match against th
233
233
FilterMenuTemplateContext theFilterContext { get; set; }
234
234
public List<string> CheckedSizes { get; set; } = new List<string>();
235
235
236
+ public bool IsCheckboxInCurrentFilter(CompositeFilterDescriptor filterDescriptor, string size)
237
+ {
238
+ // get all current filter descriptors and evaluate whether to select the current checkbox
239
+ return filterDescriptor.FilterDescriptors.Select(f => (f as FilterDescriptor).Value?.ToString()).ToList().Contains(size);
240
+ }
241
+
236
242
public void UpdateCheckedSizes(bool value, string itemValue)
237
243
{
238
244
// update the list of items we want to filter by
You can’t perform that action at this time.
0 commit comments