/** * @param string $name * @param string $title * @param SS_List $dataList * @param GridFieldConfig $config */ public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) { parent::__construct($name, $title, null); $this->name = $name; if ($dataList) { $this->setList($dataList); } if (!$config) { $config = GridFieldConfig_Base::create(); } $this->setConfig($config); $state = $this->config->getComponentByType('GridState_Component'); if (!$state) { $this->config->addComponent(new GridState_Component()); } $this->state = new GridState($this); $this->addExtraClass('grid-field'); }