Id Name Birthday Status
841 Grotesque Gull 13. 4. 1962 active
842 Blasphemous Thunder Conquest 18. 10. 1981 active
843 Impossible Impala 13. 3. 1936 active
844 Political Sandwich Hunt 7. 8. 1995 deleted
845 Russian Disco Groove 23. 11. 1987 deleted
846 Impossible Impala 28. 2. 1986 inactive
847 Epic Ice Cream Pioneer 19. 8. 1987 deleted
848 Powerful Piranha 5. 5. 1941 active
849 Selfish Seal 8. 4. 1950 active
850 Obnoxious Ox 9. 10. 1976 deleted
851 Important Impala 2. 6. 1969 inactive
852 Amused Angelfish 6. 12. 1991 inactive
853 Obedient Ocelot 21. 8. 1944 inactive
854 Wide-eyed Worm 15. 6. 1996 inactive
855 Kabuki Biplane Shack 12. 3. 1949 deleted
856 Handsome Hedgehog 28. 7. 1995 deleted
857 Lazy Lapwing 27. 7. 1939 active
858 Hitler Software Overdrive 11. 1. 1972 deleted
859 The Castle of Aerobics Warfare 4. 11. 1960 active
860 Tired Tortoise 12. 5. 1939 active
( Items: 841 - 860 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;
}