Id Name Birthday Status
381 Blue-eyed Bug 5. 10. 1977 deleted
382 Revenge of Chicken Explosion 14. 3. 1971 deleted
383 Dirty Sushi Warfare 2. 1. 1988 deleted
384 Disney Unicycle Superstar 9. 4. 1970 deleted
385 Xenophobic Xenomorph 21. 5. 1978 active
386 Drab Dragonfly 25. 5. 1941 inactive
387 Sore Snake 10. 1. 1977 inactive
388 Surprise Stick All-Stars 25. 7. 1941 inactive
389 Musical Racing Spies 4. 2. 1952 active
390 Radical Zamboni Agent 3. 6. 1930 active
391 Bright Beetle 15. 5. 1992 deleted
392 The Sims: Shaving Punch-Out!! 6. 1. 1967 inactive
393 Ultraviolent Karate Remix 26. 6. 1990 active
394 Glamorous Gerenuk 5. 7. 1972 deleted
395 Sid Meier Rollerball Heroes 26. 2. 1933 active
396 Naughty Newt 22. 7. 1996 active
397 Mr. Alligator 95 25. 2. 1972 deleted
398 Beautiful Bear 7. 11. 1941 inactive
399 Difficult Dove 11. 2. 1932 active
400 Determined Dragonfly 18. 9. 1988 deleted
( Items: 381 - 400 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;
}