Id Name Birthday Status
661 German Cricket Groove 19. 9. 1988 active
662 Ho-Hum WWE Co-Op 25. 9. 1951 active
663 My First Fishing Bloodbath 28. 5. 1950 deleted
664 Indiana Jones and the Transvestite Madness 3. 6. 1963 deleted
665 Mushy Manx 2. 9. 1994 deleted
666 Magnificent Mink 16. 6. 1949 deleted
667 Open Oryx 2. 5. 1942 inactive
668 Galactic Scorched Earth Palace 19. 5. 1961 active
669 Pathetic Sandwich Boxing 10. 5. 1977 active
670 Master Chief Hammer Gone Wild 15. 4. 1978 deleted
671 Final Makeover Nightmare 15. 4. 1993 inactive
672 Muddy Mockingbird 12. 3. 1997 active
673 Zombie Batman Struggle 28. 9. 1948 deleted
674 Depressed Dugong 5. 12. 1994 active
675 The Care Bears' Business - 2nd Impact 7. 11. 1959 deleted
676 Delightful Duck 18. 1. 1988 inactive
677 Omega Hockey from Planet X 19. 9. 1965 active
678 Pro Robot in the Hood 17. 8. 1948 deleted
679 Magical Dating in the Magic Kingdom 8. 2. 1968 deleted
680 Amateur Yoga Crisis 2. 5. 1930 inactive
( Items: 661 - 680 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;
}