Id Name Birthday Status
241 Long Lapwing 19. 5. 1953 deleted
242 Aero Shopping Unit 22. 2. 1971 active
243 Prickly Panda 3. 11. 1937 deleted
244 Screaming Conga Train 28. 8. 1964 deleted
245 Smiling Shark 14. 5. 1983 inactive
246 Fair Fowl 24. 9. 1956 active
247 Dizzy Dog 25. 6. 1969 deleted
248 Sid Meier Sandwich Studio 3. 7. 1972 deleted
249 Obsessive-Compulsive Pony Desperadoes 11. 3. 2000 active
250 Master Chief Stapler Ultra 25. 2. 1996 deleted
251 Unremarkable Stick Struggle 28. 5. 1942 deleted
252 Brain-Damaged Cannibal Rider 5. 1. 1960 active
253 Agreeable Anteater 7. 5. 1974 deleted
254 In Search of Office Exhibition 6. 7. 1998 deleted
255 Encouraging Echidna 2. 2. 1975 deleted
256 Ashamed Aardvark 11. 12. 1961 active
257 Prickly Puffin 11. 2. 1994 deleted
258 Brave Bee 7. 10. 1985 deleted
259 Joyous Jellyfish 10. 8. 1970 deleted
260 Anxious Addax 19. 6. 1956 deleted
( Items: 241 - 260 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;
}