Id Name Birthday Status
361 Sleepy Seal 24. 3. 1939 deleted
362 Allied Shopping Kingdom 1. 4. 1998 inactive
363 Deranged Sailor Brothers 23. 11. 1937 deleted
364 Tactical Barbarian - The Card Game 1. 2. 1971 active
365 Aero Jetski Assault 6. 11. 1942 active
366 Frisky Bongo Spectacular 22. 5. 1942 deleted
367 Smoggy Skylark 10. 2. 1982 inactive
368 Android Shadow Syndrome 21. 7. 1995 active
369 Death-Defying Basketball Troopers 21. 7. 1970 deleted
370 Fine Flamingo 17. 7. 1961 active
371 Gleaming Grasshopper 16. 4. 1942 inactive
372 Frail Fish 25. 4. 2000 inactive
373 Cthulhu Amish Fiesta 27. 2. 1937 inactive
374 Helpless Hare 6. 8. 1998 inactive
375 Clumsy Crayfish 8. 12. 1981 deleted
376 Brave Boar 1. 5. 1934 active
377 Atomic Cyborg Conflict 27. 5. 1963 active
378 Vivacious Vicuña 5. 7. 1951 active
379 Nasty Nightingale 5. 6. 1977 inactive
380 Testy Teira 1. 4. 1933 active
( Items: 361 - 380 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;
}