Id Name Action
641 Dangerous Kangaroo Party Blahblah
642 Nasty Narwhal Blahblah
643 Nice Nightingale Blahblah
644 Mushy Mole Blahblah
645 Adorable Anteater Blahblah
646 Maniac Spatula Tycoon Blahblah
647 Confused Cheetah Blahblah
648 Shy Serval Blahblah
649 Demonic Sex Express Blahblah
650 Jittery Jay Blahblah
651 Fisher Price Yeti Dancers Blahblah
652 Cute Chicken Blahblah
653 Fair Flatworm Blahblah
654 Joyous Jackal Blahblah
655 Adventurous Armadillo Blahblah
656 Deadly Bazooka Hunter Blahblah
657 Blissful Amish Combat Blahblah
658 Fancy Falcon Blahblah
659 First-Person Katana Task Force Blahblah
660 Drab Deer Blahblah
( Items: 641 - 660 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;
}