Id Name Action
881 Android Piano Derby Blahblah
882 Nihilistic Scooter Hell Blahblah
883 Confused Curlew Blahblah
884 Jealous Jaguar Blahblah
885 Careful Cod Blahblah
886 Strange Shrike Blahblah
887 Scary Swiftlet Blahblah
888 Everybody Hates the Sumo Princess Blahblah
889 Puzzled Pigeon Blahblah
890 Maniac Paintball Rave Blahblah
891 Ugliest Unicorn Blahblah
892 Samurai Whale Underground Blahblah
893 Wild Worm Blahblah
894 Impossible Ibex Blahblah
895 Thankful Tarantula Blahblah
896 Happy Herring Blahblah
897 Embarrassed Eel Blahblah
898 Unpleasant Mushroom Corps Blahblah
899 Dizzy Dove Blahblah
900 The Six Million Dollar Whale Baseball Blahblah
( Items: 881 - 900 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;
}