Id Name Birthday Status
601 Concerned Cheetah 3. 9. 1952 active
602 Joyous Jellyfish 9. 1. 1939 inactive
603 Savage Outlaw Rebellion 8. 4. 1971 deleted
604 Disgusted Dormouse 16. 6. 1999 deleted
605 Sore Stoat 8. 11. 1967 deleted
606 Helicopter Fantasy X 13. 12. 1984 active
607 Awful Alpaca 6. 11. 1995 active
608 Adventurous Armadillo 8. 1. 1972 inactive
609 Motionless Mongoose 23. 3. 1999 deleted
610 Grand Bow Hunter Terror 19. 4. 1979 inactive
611 Shy Starling 20. 3. 1966 deleted
612 Cautious Chimpanzee 28. 2. 1966 deleted
613 Christian Makeout DJ 26. 7. 1964 inactive
614 Troubled Tarantula 27. 2. 1986 deleted
615 Peaceful Death Onslaught 22. 10. 1934 inactive
616 Amish College EX 22. 11. 1948 active
617 The Sims: Moon - The Quickening 28. 9. 1946 active
618 Latino Death For Kids 18. 8. 1944 active
619 Yellowed Yak 28. 2. 1944 inactive
620 Frantic Fox 23. 6. 1971 active
( Items: 601 - 620 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')
		->setSortable();

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

	$grid->addColumnDateTime('birth_date', 'Birthday');

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

	$grid->addExportCallback('Dump to ajax rq', function (array $rows, DataGrid $grid): void {
		echo 'All fetched data were passed to export callback. Size of data: ';
		echo count($rows);
		die;
	})->setAjax();

	$grid->addExportCsvFiltered('Csv export (filtered)', 'examples.csv')
		->setTitle('Csv export (filtered)');

	$columnName = new ColumnText($grid, 'name', 'name', 'Name');
	$columnEven = (new ColumnText($grid, 'even', 'even', 'Even ID (yes/no)'))
		->setRenderer(
			fn ($item) => $item['id'] % 2 === 0 ? 'No' : 'Yes'
		);

	$grid->addExportCsv('Csv export', 'examples-all.csv')
		->setTitle('Csv export')
		->setColumns([
			$columnName,
			$columnEven,
		]);

	return $grid;
}