How to add SelectAll Checkbox in CustomerFilterMenu which has customcheckbox list

1 Answer 248 Views
Checkbox Filter Grid
Nitesh
Top achievements
Rank 2
Nitesh asked on 10 Jun 2022, 07:27 AM

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

Benjamin
Top achievements
Rank 2
Iron
commented on 10 Jun 2022, 08:29 AM

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.

Nitesh
Top achievements
Rank 2
commented on 10 Jun 2022, 08:37 AM | edited

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

1 Answer, 1 is accepted

Sort by
0
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 10 Jun 2022, 03:43 PM
Nitesh
Top achievements
Rank 2
commented on 13 Jun 2022, 07:53 AM

Hi Timothy,

 

This is inbuilt checkbox with selectALL feature, since i need another filter criteria along with checkbox just similar to WPF filter one i need to build custom filter menu.

Now i am feeling the customization is really painful for the filter atleast.

regards,

nitesh

Tags
Checkbox Filter Grid
Asked by
Nitesh
Top achievements
Rank 2
Answers by
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or