Disabling a TelerikgridCheckboxColumn on data load

1 Answer 113 Views
Checkbox Grid
Afreen
Top achievements
Rank 1
Iron
Afreen asked on 17 Apr 2023, 07:01 PM

Hi,

I am using telerikgrid control to display the employees information. I have telerikgridcheckboxcolumn which is bind to a IEnumerable list of employee who are eligible for promotion.

I am looking for a solution to disable this header checkbox when there is none of the employee is eligible for promotion. 

Please see below my code snippet for Grid and Checkbox:

 

<TelerikGrid Data="ShipmentInfo" SelectionMode="GridSelectionMode.Multiple" SelectedItems="SelectedEmployees" Class="grid-no-scroll" Sortable="true" Size="Telerik.Blazor.ThemeConstants.Grid.Size.Medium" Resizable="true" Pageable="false" Height="55vh" ScrollMode="GridScrollMode.Scrollable" FilterMode="GridFilterMode.None" OnRowRender="@OnRowRenderHandler" SelectedItemsChanged="@((IEnumerable<EmployeeInfoDto> employeess) => SelectedItemsChanged(employees))">

 

<GridCheckboxColumn Title="Allow Promotion" SelectAll="true" CheckBoxOnlySelection="true" HeaderClass="@GetHeaderCssClass()"></GridCheckboxColumn>

 

 private void SelectedItemsChanged(IEnumerable<EmployeeInfoDto> employees)
    {
        // Checkboxes are disabled for shipments that aren't allowed to be routed but we don't want the select all function to select unroutable shipments
        // so remove any unroutable shipments from the given collection and set that to the SelectedItems collection
        SelectedEmployees = employeess.Where(s => s.EligibleForPromotion).ToList();
    }

 

Please can you help get my desired requirement.

Thanks & regards,

 

Afreen

1 Answer, 1 is accepted

Sort by
0
Hristian Stefanov
Telerik team
answered on 20 Apr 2023, 08:30 AM

Hi Afreen,

I have already provided information that gives a solution to this question in the following public post: Disabling the header level TelerikGridCheckboxColumn.

If there are still difficulties or if I'm missing something, I'm at your disposal to keep the conversation there so it is all in one place.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Checkbox Grid
Asked by
Afreen
Top achievements
Rank 1
Iron
Answers by
Hristian Stefanov
Telerik team
Share this question
or