Id Name Action
501 Ultra Puppy Strikes Back Blahblah
502 Itchy Impala Blahblah
503 Dynamite Viking Symphony Blahblah
504 Final Fantasy Dodgeball in the Salad Kingdom Blahblah
505 Neon Bass in the Magic Kingdom Blahblah
506 Scandinavian Desert Attack Blahblah
507 Depressing Karaoke Z Blahblah
508 Prehistoric Fashion Crusader Blahblah
509 Dance Dance Stapler Plus Blahblah
510 Blue-eyed Batfish Blahblah
511 Frightened Flamingo Blahblah
512 Christian Mummy in Busytown Blahblah
513 Wandering Wolf Blahblah
514 Art of Blood DS Blahblah
515 Handsome Hyena Blahblah
516 Geriatric Skate of Doom Blahblah
517 Worried Wombat Blahblah
518 Lair of the Go-Kart Agent Blahblah
519 Tense Turkey Blahblah
520 Royal Underwear Syndicate Blahblah
( Items: 501 - 520 from 1020 )
  See the code below 👇 or see GitHub
public function createComponentGrid(): DataGrid
{
	$grid = new DataGrid();

	$grid->setDataSource($this->dibiConnection->select('*')->from('users'));

	$grid->setItemsPerPageList([20, 50, 100]);

	$grid->setSortable();

	$grid->addColumnNumber('id', 'Id')
		->setAlign('start')
		->setSortable();

	$grid->addColumnText('name', 'Name')
		->setSortable();

	$multiAction = $grid->addMultiAction('multi_blah', 'MultiAction')
		->addAction('blah', 'Blahblah', 'blah!')
		->addAction('blah2', 'Blahblah2', 'blah!', ['name']);

	$multiAction
		->getAction('blah2')
		->setIcon('check');

	$grid->addAction('blah', 'Blahblah', 'blah!')
		->setClass('btn btn-xs btn-primary ajax');

	$grid->addAction('this', '')
		->setIcon('redo')
		->setClass('btn btn-xs btn-success');

	$actionCallback = $grid->addActionCallback('custom_callback', '');

	$actionCallback
		->setIcon('sun')
		->setTitle('Hello, sun')
		->setClass('btn btn-xs btn-default btn-secondary ajax');

	$actionCallback->onClick[] = function ($itemId): void {
		$this->flashMessage('Custom callback triggered, id: ' . $itemId);
		$this->redrawControl('flashes');
	};

	$grid->addAction('delete', '', 'delete!')
		->setIcon('trash')
		->setTitle('Delete')
		->setClass('btn btn-xs btn-danger ajax')
		->setConfirmation(
			new StringConfirmation('Do you really want to delete example %s?', 'name')
		);

	$grid->addToolbarButton('this', 'Toolbar')->addAttributes(['foo' => 'bar']);
	$grid->addToolbarButton('this#2', 'Button', ['foo' => 'bar']);

	return $grid;
}