Id Name Action
741 Unpleasant Fencing Epidemic Blahblah
742 Space Music Underworld Blahblah
743 Day of the Chase Strikes Again Blahblah
744 Screaming Lawnmower School Blahblah
745 Worried Wryneck Blahblah
746 Victorious Vicuña Blahblah
747 Third-World Dog Smash Blahblah
748 Aero Outlaw of Mystery Blahblah
749 Street STD Summit Blahblah
750 Happy Batman Roundup Blahblah
751 Perfect Piranha Blahblah
752 Colorful Constrictor Blahblah
753 Hurt Hedgehog Blahblah
754 Shameful Sunshine III Blahblah
755 Unusual Unicorn Blahblah
756 Thankful Tern Blahblah
757 Fruity Acid Revisited Blahblah
758 Talented Teira Blahblah
759 My Very Own Army Forever Blahblah
760 Vast Vicuña Blahblah
( Items: 741 - 760 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;
}