Id Name Birthday Status
441 Uptight Unicorn 14. 7. 1958 active
442 Misty Macaque 17. 9. 1974 active
443 Imperial Hoedown Havoc 16. 8. 1959 inactive
444 Panicky Porpoise 8. 5. 1994 inactive
445 Attractive Alligator 10. 8. 1941 deleted
446 Joyous Jay 2. 8. 1998 deleted
447 Spectacular Thief in the Hood 6. 2. 1953 deleted
448 Big Stunt from Mars 23. 11. 1974 inactive
449 Masters of Beach School 2. 9. 1951 inactive
450 Disturbed Dog 14. 10. 1946 deleted
451 Horrible Horse 6. 10. 1995 active
452 Beautiful Driving Vengeance 18. 8. 1954 inactive
453 Lazy Breakdancing Challenge 24. 5. 1955 deleted
454 Super Spider 24. 12. 1963 deleted
455 Alive Ant 8. 4. 1954 deleted
456 Pleasant Platypus 4. 1. 1992 deleted
457 Hindu Frisbee in Space 5. 5. 2000 deleted
458 Rockin' Lego Patrol 8. 4. 1948 deleted
459 Better Barracuda 26. 3. 1939 deleted
460 Defeated Dugong 8. 11. 2000 deleted
( Items: 441 - 460 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;
}