Id Name Birthday Status
81 Selfish Snail 23. 9. 1998 active
82 Prehistoric Toon Interactive 2. 6. 1969 active
83 Disturbed Dunlin 21. 3. 1991 deleted
84 Itchy Impala 8. 1. 1978 deleted
85 Good Gnu 23. 3. 1964 deleted
86 Dance Dance Jazz Park 4. 10. 1980 deleted
87 Fisher Price Bingo Man 26. 1. 1930 inactive
88 Bewildering Batman Revenge 24. 4. 1984 active
89 Political Scorched Earth Syndrome 11. 6. 1948 inactive
90 Naughty Narwhal 8. 12. 1994 deleted
91 Xenophobic Xenomorph 10. 2. 1958 inactive
92 Cooperative Camel 23. 8. 1935 inactive
93 Famous Falcon 20. 5. 1941 inactive
94 Samurai Dance Fiasco 17. 6. 1955 deleted
95 Terrible Teira 3. 9. 1947 deleted
96 Robot Dating Force 6. 1. 1956 deleted
97 Better Butterfly 12. 6. 1956 deleted
98 Yellowed Yacare 1. 11. 1978 active
99 Cruel Crayfish 5. 1. 1973 deleted
100 Morbidly Obese Maze Playhouse 19. 8. 1953 inactive
( Items: 81 - 100 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;
}