Disable select all checkbox in Grid

1 Answer 1121 Views
Grid
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Bernd asked on 05 Nov 2021, 12:59 PM

I have used the Grid component with the select functionality and was wondering if I can somehow disable the select all checkbox in the header but still be able to select multiple rows of the grid. Is this possible?

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Konstantin Dikov
Telerik team
answered on 08 Nov 2021, 10:36 AM

Hi Bernd,

For achieving the desired result you can either handle the "headerCellRender" and return empty TD element for the select column or provide a custom headerCell directly.

1) headerCellRender approach:

  const headerCellRender = (td, props) => {
    if (props.field == SELECTED_FIELD) {
      return <td {...td.props}></td>;
    }
    return td;
  };

Here is an example with the above implementation:

2) headerCell approach (https://www.telerik.com/kendo-react-ui/components/grid/api/GridHeaderCell/):

        <Column
          headerCell={() => <td></td>}
          field={SELECTED_FIELD}

 

Best Regards,
Konstantin Dikov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
commented on 08 Nov 2021, 11:39 AM

Thanks. The <td></td> doesn't work because I get the error that a <td> can't be a child of a <th>. But if I exchange the <td></td> with a <span></span> it works. :-)

Thanks anyway for letting me know about the approach. That's really usefull information.

Tags
Grid
Asked by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Konstantin Dikov
Telerik team
Share this question
or