Checkbox for mark all record in table

Hello, I have a doubt about being able to mark all records in a Table. Can this be done through a check ?, is that keys can through the operating system but if there are many records becomes uncomfortable. If a checkbox to mark all is possible and for example the datasource assigned to the Table has 100 records but only displays 10 in the Table, to obtain the selected records that would give me 10 or 100?
Thanks and regards.


you can use selectAll method of Table to select all rows (not only visible, but all loaded by datasource).

Example layout:

<layout expand="usersTable"
    <checkBox id="selectAllChecker"
              caption="Select all"/>
    <table id="usersTable"
            <column id="login"/>
            <column id="name"/>
            <column id="position"/>
            <column id="email"/>
        <rows datasource="usersDs"/>


public class UserList extends AbstractWindow {

    protected Table<User> usersTable;

    protected CheckBox selectAllChecker;

    protected CollectionDatasource<User, UUID> usersDs;

    public void init(Map<String, Object> params) {

        usersDs.addItemChangeListener(e -> {
            // if select all rows manually, set checker value to true
            if (usersTable.getSelected().size() == usersDs.size()) {

        selectAllChecker.addValueChangeListener(e -> {
            if (Boolean.TRUE.equals(selectAllChecker.getValue())) {
            } else {

In this case all items of datasource will be marked as selected, just scroll table to make sure of it.

Fantastic Yuriy, thank you.