Id Name Birthday Status
61 Blocky Octopus Horde 10. 10. 1945 deleted
62 Little Hang Glider Tournament 13. 7. 1960 deleted
63 Fine Flatworm 27. 12. 1945 deleted
64 Underground Chess Feud 19. 7. 1936 deleted
65 Irritating Blood of the Deep 5. 12. 1974 active
66 Dangerous Buddhist in the Salad Kingdom 20. 11. 1985 deleted
67 Terrible Teira 25. 5. 1986 deleted
68 Mexican Hair Salon in the Hood 5. 8. 1934 active
69 Depressed Dogfish 21. 4. 1981 inactive
70 First-Person Snowboard Rider 10. 5. 1973 deleted
71 Underwater Shopping Football 12. 1. 1963 deleted
72 Glamorous Gemsbok 16. 10. 1974 inactive
73 New Bow Hunter Thieves 13. 7. 1984 active
74 Nuclear Dating Special Edition 4. 7. 1935 inactive
75 Awesome Mummy Annihilation 8. 12. 1957 active
76 Irresistible Fire Psychiatrist 21. 11. 1956 active
77 Ill Iguana 9. 4. 1996 deleted
78 Wide-eyed Walrus 27. 9. 1943 deleted
79 Grumpy Goldfinch 26. 3. 1937 inactive
80 Helpful Hippopotamus 24. 9. 1951 active
( Items: 61 - 80 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;
}