How can i get the selected Rows of a grid

hi,

I created a simple grid according the example

I have added one colum with check box and more menu item as action to excute the action.

Bute how can I get the selected rows?

THX

Peter

Here’s a snippet how I do it. In this example the $_GET variable named ‘selection’ will contain the selected items when it opens the VirtualPage.

$virtual_page = $app->add('VirtualPage');
$grid_selection = $grid->addSelection();
$button = $grid->menu->addItem(['Quick Edit Selected']);
$button->set(['icon' => 'edit outline'])->on('click', function() use ($grid, $grid_selection, $virtual_page) {
	return [(new \atk4\ui\jsModal('(Multiple Items)', $virtual_page, ['selection' => $grid_selection->jsChecked()]))];
});

thanks. this is my solution:

$ls_selection = $ls_grid->addSelection();

         $ls_grid->menu->addItem('close',
             new \atk4\ui\jsReload($ls_grid->table, [
                 'free'=>$ls_selection->jsChecked(),
                 'action'=>'close'
                 // 22
             ]));

and you can get the array of ids with get

if (!empty($lv_free)) {

         $lt_array = array();
            foreach(explode(',', $_GET['free']) as $id) {
                array_push($lt_array, intval($id));
            }
            
           // switch($_GET['action']) {
            switch($lv_action) {.....