Id Name Birthday Status
741 Unpleasant Fencing Epidemic 15. 5. 1977 inactive
742 Space Music Underworld 14. 12. 1961 active
743 Day of the Chase Strikes Again 12. 10. 1934 deleted
744 Screaming Lawnmower School 2. 12. 1976 deleted
745 Worried Wryneck 12. 6. 1995 deleted
746 Victorious Vicuña 11. 4. 1992 inactive
747 Third-World Dog Smash 28. 11. 1981 deleted
748 Aero Outlaw of Mystery 10. 9. 1982 active
749 Street STD Summit 13. 4. 1965 deleted
750 Happy Batman Roundup 10. 4. 1942 deleted
751 Perfect Piranha 27. 9. 1930 deleted
752 Colorful Constrictor 4. 1. 1961 deleted
753 Hurt Hedgehog 17. 6. 1946 inactive
754 Shameful Sunshine III 24. 3. 1990 deleted
755 Unusual Unicorn 24. 8. 1963 deleted
756 Thankful Tern 16. 2. 1948 deleted
757 Fruity Acid Revisited 28. 7. 1947 deleted
758 Talented Teira 3. 8. 1937 deleted
759 My Very Own Army Forever 25. 2. 1957 deleted
760 Vast Vicuña 20. 8. 2000 inactive
( Items: 741 - 760 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;
}