File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
components/grid/templates Expand file tree Collapse file tree 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
212212 @foreach (var size in Sizes)
213213 {
214214 <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}")">
219219 </TelerikCheckBox>
220220 <label for="@($"size_{size}")">
221221 @size
@@ -233,6 +233,12 @@ This custom filter menu lets you choose more than one option to match against th
233233 FilterMenuTemplateContext theFilterContext { get; set; }
234234 public List<string> CheckedSizes { get; set; } = new List<string>();
235235
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+
236242 public void UpdateCheckedSizes(bool value, string itemValue)
237243 {
238244 // update the list of items we want to filter by
You can’t perform that action at this time.
0 commit comments