Id Name Action
261 Good Goat Blahblah
262 Upset Unicorn Blahblah
263 Nasty Unicorn of the Blood God Blahblah
264 Virtua Casino Gaiden Blahblah
265 Profane Trailer Park Extravaganza Blahblah
266 Obnoxious Oryx Blahblah
267 Sid Meier Quiz Agent Blahblah
268 Spirit of the Bow Hunter Dash Blahblah
269 It a Mad, Mad Wheelchair Dash Blahblah
270 Gorgeous Gaur Blahblah
271 Masters of Fantasy Rangers Blahblah
272 Invisible Badminton Insurrection Blahblah
273 Comfortable Coyote Blahblah
274 Cthulhu Lizard Operatives Blahblah
275 Lazy Louse Blahblah
276 Mickey Mech Restaurant Blahblah
277 Prickly Partridge Blahblah
278 Sleepy Sandpiper Blahblah
279 Scandinavian Booty Marines Blahblah
280 Good Goose Blahblah
( Items: 261 - 280 from 1016 )
  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;
}