Id Name Birthday Status
321 Zealous Zebra 8. 3. 1999 deleted
322 Real Raccoon 6. 2. 1944 active
323 Fiery Equestrian - The Revenge 20. 8. 1947 active
324 Bad Barracuda 17. 8. 1971 active
325 Jedi Rabbit Brothers 22. 4. 1934 inactive
326 Invisible Driving Caper 18. 6. 1956 active
327 Stormy Spider 24. 10. 1934 inactive
328 Courageous Crocodile 24. 8. 1931 active
329 Clumsy Crossbill 2. 1. 1947 deleted
330 Colorful Chipmunk 1. 5. 1948 deleted
331 Sonic Castlevania Championship 14. 12. 1975 deleted
332 Light Ladybird 18. 10. 1942 deleted
333 Inexpensive Ibex 14. 6. 1975 deleted
334 Perfect Panda 23. 7. 1942 deleted
335 Depressed Duck 25. 5. 1936 active
336 Irish Motorcycle Uprising 23. 3. 1989 deleted
337 Curious Crossbill 3. 5. 1940 deleted
338 Agreeable Ant 14. 3. 1943 deleted
339 Enchanting Eagle 9. 2. 1941 deleted
340 Plain Peafowl 13. 12. 1989 deleted
( Items: 321 - 340 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;
}