Add checkbox in header of the table

Hi,

I have a table and in that a generated column with checkbox in it.

I want to add a checkbox in header of that column, so that when it’s checked all the checkbox in the generated column also gets checked, vice versa.

Thanks in advance

Hi,

It seems that DataGrid with selectionMode="MULTI_CHECK" fits your needs (see demo).

Screenshot 2023-02-15 at 16.14.58

Regards,
Gleb

But I also need to give a name to the checkbox column header.

The header should contain a checkbox and name of the column as well

DataGrid supports adding several header rows/cells, see demo.

Hi,

Thanks for up till now.

I still have one doubt remaining.

In header, I have a checkbox with caption. Now clicking on the header checkbox all the rows should get checked or unchecked.

I have created a checkbox component in java and then added it in header cell using setComponent method.

And for all the checkbox in the rows are created using column generator

Hi,

I have implemented all custom header which works as a select all checkbox.

It works but only for current page i.e. It selects all the data of the current page, not for next pages. How do I implement it for next pages ?

Thanks in advance.