Ok I have created a dataobject where you can import a Ticket report, and it will spit out a filtered an formatted XLXS report according to the clients wishes. The filtering of the record is done by hidden them and not deleting them.
Now here is what I would like to have; one modeladmin with 2 tabs, one that shows all the current records and one that shows all the hidden records.
Is this possible? I know I can make 2 different modeladmins but I would like to do it in one if possible.
Here is my modeladmin:
class TicketReportAdmin extends ModelAdmin
{
private static $managed_models = array(
'TicketReport'
);
private static $url_segment = 'TicketReport';
private static $menu_priority = 99;
private static $menu_icon = 'images/menu-icons/star.png';
private static $awesome_icon = "fa-list-ol";
private static $menu_title = 'Ticket Report';
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
//This check is simply to ensure you are on the managed model you want adjust accordingly
if ($this->modelClass == 'TicketReport' && $gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass))) {
if ($gridField instanceof GridField) {
$gridField->setTitle('Ticket Report');
$gridField->getConfig()->getComponentByType('GridFieldPaginator')->setItemsPerPage(250);
$gridField->getConfig()->addComponent(new GridFieldExportButton2('before'));
$gridField->getConfig()->addComponent(new GridFieldDeleteAllButton('before'));
}
}
return $form;
}
}