Id Name Status Action
841 Grotesque Gull
842 Blasphemous Thunder Conquest
843 Impossible Impala
844 Political Sandwich Hunt
845 Russian Disco Groove
846 Impossible Impala
847 Epic Ice Cream Pioneer
848 Powerful Piranha
849 Selfish Seal
850 Obnoxious Ox
851 Important Impala
852 Amused Angelfish
853 Obedient Ocelot
854 Wide-eyed Worm
855 Kabuki Biplane Shack
856 Handsome Hedgehog
857 Lazy Lapwing
858 Hitler Software Overdrive
859 The Castle of Aerobics Warfare
860 Tired Tortoise
( Items: 841 - 860 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;
}