Advertisement
Guest User

Untitled

a guest
Jan 4th, 2020
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1.  
  2. //template item-detail-grid.latte
  3. {extends $originalTemplate}
  4. {block detail}
  5. <button class="btn btn-default btn-secondary btn-sm">Just a button</button>
  6. {/}
  7.  
  8. //template Presentru
  9. {block content}
  10. <div class="container">
  11. <h1 n:block="title" class="text-center">aaa</h1>
  12. {control datagrid}
  13. </div>
  14. //metoda v Presentru
  15. public function createComponentDatagrid()
  16. {
  17. $grid = new DataGrid;
  18.  
  19. $grid->setDataSource($this->userManager->getUsers());
  20. //columns
  21. $grid->addColumnNumber('id', 'ID');
  22. $grid->addColumnText('name', 'Jmeno')->setSortable();
  23. $grid->addColumnText('superuser', 'Admin');
  24. $grid->addColumnText('email', 'E-mail');
  25. $grid->addColumnDateTime('lastLoginDate', 'Naposled přihlašen');
  26. $grid->addColumnStatus('state', 'Status');
  27. //filters
  28. $grid->addFilterSelect('state', 'Status', State::ALL);
  29. $grid->addFilterText('name', 'Jmeno');
  30. //set details for user
  31.  
  32.  
  33. $grid->setItemsDetail();
  34.  
  35. $grid->setTemplateFile(__DIR__ . '/../templates/datagrid/item-detail-grid.latte');
  36.  
  37. return $grid;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement