Id Name Birthday Status
501 Ultra Puppy Strikes Back 15. 6. 1980 deleted
502 Itchy Impala 6. 12. 1957 deleted
503 Dynamite Viking Symphony 16. 12. 1970 deleted
504 Final Fantasy Dodgeball in the Salad Kingdom 18. 5. 1930 deleted
505 Neon Bass in the Magic Kingdom 22. 12. 1938 active
506 Scandinavian Desert Attack 10. 8. 1977 inactive
507 Depressing Karaoke Z 19. 3. 1952 deleted
508 Prehistoric Fashion Crusader 4. 10. 1991 deleted
509 Dance Dance Stapler Plus 9. 7. 1986 deleted
510 Blue-eyed Batfish 13. 3. 1947 deleted
511 Frightened Flamingo 2. 2. 1945 deleted
512 Christian Mummy in Busytown 4. 1. 1991 deleted
513 Wandering Wolf 16. 10. 1996 deleted
514 Art of Blood DS 18. 6. 1983 inactive
515 Handsome Hyena 13. 12. 1993 deleted
516 Geriatric Skate of Doom 10. 8. 1963 deleted
517 Worried Wombat 5. 2. 1940 deleted
518 Lair of the Go-Kart Agent 5. 9. 1960 inactive
519 Tense Turkey 22. 1. 1960 active
520 Royal Underwear Syndicate 11. 11. 1941 deleted
( Items: 501 - 520 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;
}