Getting all the row id across the paging page

I have a grid with paging.
I have a datatset of 272 records.
The grid displays 50 rows per page.
In the first column of the grid, I have checkbox.

First time, the grid loads the first 50 rows and displays the paging bar with 6 “bricks” (1, 2, 3, 4, 5, 6)

In brick 1, I select the checkbox of few rows.
Then I go to brick 2.
In brick 2, again I select the checkbox of few rows.
And the process continue where I can select the checkbox across the bricks.

My question is how do I get the id of ALL selected rows in ALL the bricks?

Appreciate support help with samples.

Any help from Support for my question?