Id Name Birthday Status
901 Zany Zebra 17. 1. 1973 deleted
902 Jamaican Walrus Corps 7. 5. 1984 deleted
903 Outrageous Osprey 1. 5. 1946 deleted
904 Better Boar 10. 4. 1978 deleted
905 Disgusted Dunlin 17. 11. 1974 deleted
906 Disgusted Dingo 8. 10. 1938 deleted
907 Cheerful Cormorant 19. 2. 1971 active
908 Trendy Bubble Camp 27. 12. 1931 deleted
909 Sinister Fighter Romp 18. 8. 1967 deleted
910 Ugliest Unicorn 28. 10. 1950 deleted
911 Grumpy Gerbil 28. 11. 1949 inactive
912 Fatal Kitchen Master 22. 1. 1946 deleted
913 Ugliest Unicorn 7. 12. 1989 deleted
914 Bizarro Spork Melee 12. 7. 1982 deleted
915 Quaint Quetzal 12. 9. 1976 deleted
916 Good Guanaco 7. 5. 1994 deleted
917 Italian Burger in Vegas 11. 6. 1945 deleted
918 Fruity Chase Quiz 2. 4. 1981 deleted
919 Pleasant Penguin 12. 5. 1983 deleted
920 Telekinetic Hillbilly Odyssey 27. 8. 1950 active
( Items: 901 - 920 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;
}