Id Name Birthday Status
881 Android Piano Derby 25. 4. 1963 deleted
882 Nihilistic Scooter Hell 8. 10. 1948 inactive
883 Confused Curlew 27. 2. 1997 active
884 Jealous Jaguar 19. 9. 1977 inactive
885 Careful Cod 12. 7. 1996 inactive
886 Strange Shrike 1. 1. 1955 active
887 Scary Swiftlet 28. 8. 1988 deleted
888 Everybody Hates the Sumo Princess 15. 10. 1995 deleted
889 Puzzled Pigeon 26. 9. 1939 deleted
890 Maniac Paintball Rave 25. 2. 1988 deleted
891 Ugliest Unicorn 6. 6. 1941 deleted
892 Samurai Whale Underground 11. 9. 1983 deleted
893 Wild Worm 11. 12. 1994 active
894 Impossible Ibex 2. 7. 1943 active
895 Thankful Tarantula 5. 8. 1960 inactive
896 Happy Herring 20. 10. 1954 deleted
897 Embarrassed Eel 17. 12. 1934 deleted
898 Unpleasant Mushroom Corps 28. 3. 1933 deleted
899 Dizzy Dove 12. 12. 1969 deleted
900 The Six Million Dollar Whale Baseball 18. 10. 1998 deleted
( Items: 881 - 900 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;
}