Id Name Action
621 Dark Dormouse Blahblah
622 Naughty Newt Blahblah
623 Terrible Tuatara Blahblah
624 Easy Emu Blahblah
625 Electric Mummy Epidemic Blahblah
626 Different Dugong Blahblah
627 Agreeable Alligator Blahblah
628 Unpleasant Caveman XP Blahblah
629 Wrong Walrus Blahblah
630 Arrogant Albatross Blahblah
631 Barbie Barcode in the Salad Kingdom Blahblah
632 Anxious Anteater Blahblah
633 Subatomic Shopping Palace Blahblah
634 Nighttime Puppy - The Revenge Blahblah
635 Adventurous Addax Blahblah
636 Outrageous Oyster Blahblah
637 Nudist City Man Blahblah
638 Aggressive Alpaca Blahblah
639 Elite Llama Tycoon Blahblah
640 Weary Wren Blahblah
( Items: 621 - 640 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;
}