Hi,
I am following below demo for adding custom filter menu with checboxes.
https://demos.telerik.com/blazor-ui/grid/custom-filter-menu
But it doesn't come with SelectAll checkbox option, please let me know how can add that option.
regards,
nitesh
Hi,
I am following below demo for adding custom filter menu with checboxes.
https://demos.telerik.com/blazor-ui/grid/custom-filter-menu
But it doesn't come with SelectAll checkbox option, please let me know how can add that option.
regards,
nitesh
Hi Nitesh,
if you haven't selected any checkbox, it's actually equal to a "SelectAll".
The downside of using custom templates instead of using the default "out-of-the-box" functionality comes with a lot of manual effort (I feel your pain ;))
As far as I understand your question:
<FilterMenuTemplate> @{ <div class="filter-values-container"> <TelerikCheckBox Value="@SelectedAll" ValueChanged="@((bool value) => ToggleSelectAll(value))" Id="selectAll"> </TelerikCheckBox> @foreach (var name in Names) { <div> <TelerikCheckBox Value="@(GetFilterValues(context.FilterDescriptor).Contains(name))" ValueChanged="@((bool value) => ColumnValueChanged(value, name, nameof(EmployeeDto.FirstName), context.FilterDescriptor))" Id="@($"name_{name}")"> </TelerikCheckBox> <label for="@($"name_{name}")"> @name </label> </div> } </div> } </FilterMenuTemplate>
Add the variable bool SelectedAll + the method ToggleSelectAll(bool value) where you process the filter state.
Hi Benjamin,
thank you for sharing your thoughts on this. Although where do you set or unset SelectedAll. And when i check on Select All, where do i set all my checkboxes option to Checked state.
regards,
nitesh