Id Name Action
701 Rich Raccoon Blahblah
702 Elated Eland Blahblah
703 Frantic Flatworm Blahblah
704 Grieving Gnat Blahblah
705 Itchy Ibex Blahblah
706 Lair of the Tank Police Blahblah
707 Ancient Chocobo Disaster Blahblah
708 Tactical Hitman Power Blahblah
709 Communist Mahjong Agent Blahblah
710 Curse of the Mafia DJ Blahblah
711 Dangerous Matador Competition Blahblah
712 Beautiful Transvestite Machine Blahblah
713 Happy Hawk Blahblah
714 Cute Cormorant Blahblah
715 Interstellar Toon Tale Blahblah
716 Jittery Jackal Blahblah
717 Leisure Suit Grizzly Bear - Total War Blahblah
718 Curious Crossbill Blahblah
719 Yellowed Yak Blahblah
720 Catholic Pokemon 3D Blahblah
( Items: 701 - 720 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;
}