Id Name Birthday Status
981 Dwarven Bomberman Showdown 7. 7. 1942 deleted
982 Sleepy Stoat 10. 5. 1941 deleted
983 Busy Buzzard 24. 5. 1972 inactive
984 Calm Caterpillar 25. 12. 1979 deleted
985 M.C. Escher Bass Thieves 21. 9. 2000 inactive
986 My Little Punching vs. The Space Mutants 2. 7. 1998 active
987 The Muppets Computer EX 9. 6. 1932 active
988 Rad Bandicoot on Wheels 1. 2. 1973 deleted
989 God of Ninja Spree 8. 7. 1968 deleted
990 Filthy Fly 16. 1. 1977 active
991 Anxious Anteater 17. 1. 1952 deleted
992 Infinite Biplane in the Desert 18. 12. 1970 deleted
993 Smiling Seahorse 16. 2. 1947 deleted
994 Brave Beetle 23. 4. 1996 deleted
995 Testy Tern 13. 7. 1943 deleted
996 Modern Moth 21. 10. 1989 inactive
997 Faithful Ferret 2. 7. 1944 deleted
998 Helpless Hawk 28. 5. 1954 deleted
999 Enraged Internet Base 24. 2. 1998 deleted
1 000 Wide-eyed Warbler 18. 12. 1977 deleted
( Items: 981 - 1000 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;
}