Id Name Action
41 Chinese Spelunking Battle Blahblah
42 Masters of the Programming Trilogy Blahblah
43 Depressing Sudoku Arena Blahblah
44 Merciless Nazi Strike Force Blahblah
45 Grimy Mall Gaiden Blahblah
46 Cute Constrictor Blahblah
47 Defeated Dove Blahblah
48 Talented Teira Blahblah
49 Grumpy Goldfinch Blahblah
50 Golden Cardboard Ultra Blahblah
51 Amazon Elevator Agent Blahblah
52 All-Star Cheese Dash Blahblah
53 Nutty Nightingale Blahblah
54 Defeated Dog Blahblah
55 Dull Dormouse Blahblah
56 Graceful Gazelle Blahblah
57 Precious Pig Blahblah
58 Special Chase Hop-A-Bout Blahblah
59 Smiling Sandpiper Blahblah
60 Yucky Yak Blahblah
( Items: 41 - 60 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;
}