Id Name Birthday Status
341 Inappropriate Arcade Armada 9. 8. 1947 active
342 Dwarven Fun Fight Club 12. 10. 1949 active
343 Nutty Newt 16. 8. 1993 active
344 Tense Tuatara 1. 4. 1952 active
345 Brainy Buffalo 17. 2. 1991 active
346 College Devil from Planet X 5. 3. 1980 active
347 Gentle Gibbon 9. 10. 1934 active
348 Allied Dodgeball - The Next Generation 11. 9. 1961 active
349 Crowded Crab 16. 7. 1981 active
350 Enchanting Eagle 28. 2. 1951 active
351 Wicked Weasel 24. 9. 1973 active
352 Sore Sloth 6. 7. 1941 active
353 Peaceful Sewer Smash 7. 3. 1999 active
354 Peaceful Chess Party 6. 8. 1973 active
355 Nasty Narwhal 4. 10. 1935 active
356 Bloody Booty Trader 9. 3. 1993 active
357 Weary Breakdancing II 7. 1. 1967 active
358 Exuberant Eel 13. 12. 1983 active
359 Nutty Newt 10. 1. 1980 active
360 Aquatic Katana Bandits 9. 2. 1980 active
( Items: 341 - 360 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;
}