Id Name Action
21 Ebony Bass Temple Blahblah
22 Uptight Unicorn Blahblah
23 Inbred Blood Conspiracy Blahblah
24 Real Thunder Saga Blahblah
25 Hungry Hummingbird Blahblah
26 Good Goose Blahblah
27 Unusual Unicorn Blahblah
28 Aggressive Angelfish Blahblah
29 Beautiful Boar Blahblah
30 Go Go Pogo All-Stars Blahblah
31 Rock 'n' Roll Metal Assassins Blahblah
32 Dr. Spelunking Kingdom Blahblah
33 Amused Alpaca Blahblah
34 World of Bubble Gone Wild Blahblah
35 Delightful Dove Blahblah
36 Anxious Ant Blahblah
37 Big-Time Chef Blast Blahblah
38 Rural Chocobo Journey Blahblah
39 Dynamite Go-Kart Superstar Blahblah
40 Sonic Monster of Magic Blahblah
( Items: 21 - 40 from 1000 )
  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('left')
		->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;
}