Id Name Status Action
1 Klikam na asd
2 aaaa
3 aaa
4 Difficult Deer
5 Underground Harpoon Gladiator
6 Anxious Alpacaaaa a aa
7 Misty Meerkat
8 Funky Chainsaw of Mysteryasd as da
9 Sid Meier Deer Hunter Hoedown
10 Terrible Karaoke of Mystery
11 Joyous Jaguara sda sd
12 Silly Sheepasdasd
13 Grumpy Gerenuk
14 Glorious Gaur
15 Xenophobic Xenomorph
16 Relieved Rhinoceros
17 Bad Buzzard
18 Dangerous Dolphin
19 Quaint Quoll
20 Thoughtless Turkey
( Items: 1 - 20 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->addColumnNumber('id', 'Id')
		->setAlign('start')
		->setFilterText();

	$grid->addColumnText('name', 'Name')
		->setFilterText();

	$grid->addColumnStatus('status', 'Status');

	$inlineAdd = $grid->addInlineAdd();

	$inlineAdd->setPositionTop()->onControlAdd[] = function ($container): void {
		$container->addText('name', '')
			->setRequired('aaa');
		$container->addText('birth_date', '');
		$container->addText('link', '');
		$container->addSelect('status', '', [
			'active' => 'Active',
			'inactive' => 'Inactive',
			'deleted' => 'Deleted',
		]);
	};

	$inlineAdd->onSubmit[] = function ($values): void {
		$this->dibiConnection->insert(
			'users',
			[
				'name' => $values['name'],
				'status' => $values['status'],
				'countries_visited' => 1,
				'birth_date' => new DateTime(),
			]
		)->execute();
		$this->flashMessage('Record was added!', 'success');
		$this->redrawControl('flashes');
	};

	return $grid;
}