Id Name Birthday Status
541 Frail Finch 17. 2. 1942 active
542 Magnificent Mamba 21. 6. 1935 inactive
543 Itchy Impala 24. 11. 1977 deleted
544 Exquisite Furry Online 25. 4. 1997 deleted
545 Defiant Deer 18. 2. 1947 deleted
546 Final Arcade in the Bayou 11. 4. 1948 deleted
547 Brainy Beaver 10. 5. 1947 deleted
548 Graceful Gorilla 8. 9. 1978 active
549 Annoying Antelope 8. 3. 1982 deleted
550 Inexpensive Iguana 14. 7. 1975 deleted
551 Amazing Whale Brothers 6. 4. 1958 inactive
552 Joyous Jackal 21. 5. 1992 deleted
553 Thankful Tarantula 11. 8. 1985 deleted
554 Insane Axe School 16. 12. 1946 deleted
555 Arrogant Armadillo 2. 3. 1978 deleted
556 Armored Skate Plus 17. 11. 1979 active
557 Barbie Fighter Alpha 27. 4. 1978 deleted
558 Odd Otter 6. 8. 1979 deleted
559 Sparkling Snail 6. 2. 1960 deleted
560 Defiant Dugong 22. 1. 1945 deleted
( Items: 541 - 560 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;
}