Id Name Birthday Status
821 Legacy of City Ultra 12. 5. 1945 deleted
822 Micro Princess Returns 26. 11. 1939 deleted
823 Confused Camel 18. 10. 1966 deleted
824 Grieving Goose 12. 2. 1956 active
825 Expensive Eel 11. 9. 1991 deleted
826 Bling Bling Chef Derby 19. 8. 1998 active
827 Relieved Rattlesnake 13. 7. 1938 inactive
828 Smoggy Skylark 18. 7. 1948 deleted
829 Annoying Angelfish 19. 4. 1957 active
830 Gleaming Goosander 28. 9. 1986 deleted
831 Colonial Shopping Park 7. 7. 1973 deleted
832 Xenophobic Xenomorph 22. 8. 1991 active
833 Inquisitive Ibis 10. 2. 1947 deleted
834 Kind Katipo 26. 7. 1950 inactive
835 Ho-Hum Cowboy Deluxe 14. 2. 1946 deleted
836 Deadly Snowboard Strike Force 24. 4. 1940 active
837 Shiny Seahorse 14. 8. 1994 deleted
838 Energetic Eel 7. 4. 1992 active
839 Bored Bee 23. 4. 1974 active
840 Soviet Soccer Daredevils 19. 6. 1976 active
( Items: 821 - 840 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;
}