2016-08-19 00:51:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms\GridField;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A simple readonly, paginated view of records, with sortable and searchable
|
|
|
|
* headers.
|
|
|
|
*/
|
|
|
|
class GridFieldConfig_Base extends GridFieldConfig
|
|
|
|
{
|
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
|
|
|
* @param int $itemsPerPage - How many items per page should show up
|
|
|
|
*/
|
|
|
|
public function __construct($itemsPerPage = null)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->addComponent(new GridFieldToolbarHeader());
|
|
|
|
$this->addComponent($sort = new GridFieldSortableHeader());
|
|
|
|
$this->addComponent($filter = new GridFieldFilterHeader());
|
|
|
|
$this->addComponent(new GridFieldDataColumns());
|
|
|
|
$this->addComponent(new GridFieldPageCount('toolbar-header-right'));
|
|
|
|
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
$sort->setThrowExceptionOnBadDataType(false);
|
|
|
|
$filter->setThrowExceptionOnBadDataType(false);
|
|
|
|
$pagination->setThrowExceptionOnBadDataType(false);
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
$this->extend('updateConfig');
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
}
|