Id Name Birthday Age
1020 fghggf 16. 11. 2024 0
1019 testUser 29. 9. 2024 0
1018 adsfadsf 26. 9. 2024 0
1017 jjj 24. 9. 2024 0
1016 ASD 16. 9. 2024 0
1015 Ccv 10. 9. 2024 0
1014 Ccv 10. 9. 2024 0
1013 Nová položka 2. 8. 2024 0
1012 fdsfsd 5. 7. 2024 0
1011 lplplpl 2. 7. 2024 0
1010 klikam na enter22222222 12. 6. 2024 0
1009 Klikam na enter 12. 6. 2024 0
1008 tesa111 12. 6. 2024 0
1007 111 12. 6. 2024 0
1006 Ahoj click 12. 6. 2024 0
1005 Ahoj! 12. 6. 2024 0
1004 xxx 12. 6. 2024 0
1003 tvoje 12. 6. 2024 0
1002 moje 12. 6. 2024 0
1001 sss 12. 6. 2024 0
( Items: 1 - 20 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], true);

	$grid->addColumnText('id', 'Id')
		->setSortable();

	$grid->addColumnText('email', 'E-mail')
		->setSortable()
		->setFilterText();

	$grid->addColumnText('name', 'Name')
		->setFilterText();

	$grid->addColumnDateTime('birth_date', 'Birthday')
		->setFormat('j. n. Y');

	$grid->addColumnNumber('age', 'Age')
		->setRenderer(fn (Row $row): ?int => DateTime::fromSafe($row->asDateTime('birth_date'))?->diff(new DateTime())->y);

	return $grid;
}