Id Name Birthday Status
1 Klikam na asdd 23. 2. 1982 inactive
2 aaaaBCd 2. 1. 1997 inactive
3 aaa 21. 5. 1955 deleted
4 Difficult Deer 23. 5. 1964 inactive
5 Underground Harpoon Gladiator 23. 8. 1939 deleted
6 Anxious Alpacaaaa a aa 25. 9. 1985 inactive
7 Misty Meerkat 11. 3. 1974 active
8 Funky Chainsaw of Mysteryasd as da 23. 5. 1946 inactive
9 Sid Meier Deer Hunter Hoedown 20. 4. 1944 active
10 Terrible Karaoke of Mystery 10. 4. 1981 deleted
11 Joyous Jaguara sda sd 19. 9. 1994 inactive
12 Silly Sheepasdasd 19. 1. 1936 inactive
13 Grumpy Gerenuk 27. 9. 1978 inactive
14 Glorious Gaur 15. 12. 1977 active
15 Xenophobic Xenomorph 3. 3. 1987 inactive
16 Relieved Rhinoceros 11. 2. 1945 inactive
17 Bad Buzzard 8. 3. 1983 inactive
18 Dangerous Dolphin 28. 4. 1931 deleted
19 Quaint Quoll 27. 10. 1949 active
20 Thoughtless Turkey 14. 8. 1941 active
( Items: 1 - 20 from 1033 )
  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;
}