Id Name Action
201 Crazy Copperhead Blahblah
202 Smiling Shark Blahblah
203 Amused Ape Blahblah
204 Concerned Cow Blahblah
205 Worrisome Wren Blahblah
206 Romantic Chocobo Preacher Blahblah
207 Inappropriate Pinball - The Gathering Storm Blahblah
208 World of Graveyard Explosion Blahblah
209 Revenge of the Math Saloon Blahblah
210 Search for the Bowling Slaughter Blahblah
211 Bewildering Amish Train Blahblah
212 Thoughtless Thrush Blahblah
213 Atomic STD Rush Blahblah
214 Virtua Architecture Squadron Blahblah
215 Wicked Wasp Blahblah
216 Vast Vulture Blahblah
217 Yucky Yak Blahblah
218 Hindu Wheelchair City Blahblah
219 Foolish Fly Blahblah
220 Homely Hornet Blahblah
( Items: 201 - 220 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;
}