Id Name Birthday Status
521 Different Dotterel 22. 10. 1952 active
522 Ultimate Sword Collection 17. 12. 1987 deleted
523 Nice Newt 24. 10. 1945 active
524 Grumpy Gibbon 5. 9. 1970 active
525 BudgetSoft Presents: Fashion Revenge 8. 9. 1993 inactive
526 Custom Dating Extra 6. 12. 1953 active
527 Hindu Surf Project 26. 9. 1977 inactive
528 Sensual Toon Sisters 19. 4. 1972 active
529 Proud Pintail 13. 2. 1958 deleted
530 Grieving Goshawk 6. 10. 1959 deleted
531 Cautious Cardinal 14. 3. 1957 active
532 Fisher Price Handgun Scam 14. 2. 1941 deleted
533 Good Grouse 4. 9. 1943 deleted
534 Clean Chicken 7. 4. 1955 deleted
535 Courageous Caracal 10. 7. 1932 inactive
536 Aquatic Motocross Marines 16. 8. 1998 inactive
537 Interactive Biplane Palace 7. 10. 1989 inactive
538 Mexican Insect Warrior 28. 5. 1932 deleted
539 Odd Octopus 21. 9. 1944 inactive
540 Zany Desert Jam 25. 5. 1938 active
( Items: 521 - 540 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;
}