Id Name Birthday Status
261 Good Goat 22. 10. 1999 deleted
262 Upset Unicorn 6. 8. 1984 active
263 Nasty Unicorn of the Blood God 23. 6. 1998 deleted
264 Virtua Casino Gaiden 27. 5. 1964 inactive
265 Profane Trailer Park Extravaganza 18. 3. 1996 active
266 Obnoxious Oryx 15. 11. 1954 active
267 Sid Meier Quiz Agent 21. 11. 2000 deleted
268 Spirit of the Bow Hunter Dash 8. 7. 2000 deleted
269 It a Mad, Mad Wheelchair Dash 25. 1. 1942 deleted
270 Gorgeous Gaur 7. 7. 1970 deleted
271 Masters of Fantasy Rangers 7. 12. 1961 active
272 Invisible Badminton Insurrection 24. 9. 1951 deleted
273 Comfortable Coyote 4. 9. 1948 deleted
274 Cthulhu Lizard Operatives 23. 9. 1976 inactive
275 Lazy Louse 2. 5. 1941 deleted
276 Mickey Mech Restaurant 5. 3. 1941 active
277 Prickly Partridge 3. 2. 1997 inactive
278 Sleepy Sandpiper 7. 5. 1971 deleted
279 Scandinavian Booty Marines 16. 10. 1936 deleted
280 Good Goose 25. 12. 1983 deleted
( Items: 261 - 280 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;
}