Skip to content

Commit bd2971f

Browse files
committed
Added ability to set filter data manually
1 parent a00d758 commit bd2971f

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/NasExt/Controls/FilterFormControl.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,19 @@ public function getData()
135135
* @param array|string $data
136136
* @return FilterFormControl
137137
*/
138-
private function setData($data)
138+
public function setData($data)
139+
{
140+
$this->saveData($data);
141+
$this->loadData();
142+
return $this;
143+
}
144+
145+
146+
/**
147+
* @param array|string $data
148+
* @return FilterFormControl
149+
*/
150+
private function saveData($data)
139151
{
140152
$filter = array();
141153
foreach ($data as $key => $value) {
@@ -195,7 +207,7 @@ protected function createComponentForm()
195207
public function processSubmit(SubmitButton $button)
196208
{
197209
$values = $button->getForm()->getValues(TRUE);
198-
$this->setData($values);
210+
$this->saveData($values);
199211
$this->onFilter($this, $this->getData());
200212

201213
if (!$this->presenter->isAjax()) {
@@ -243,7 +255,7 @@ public function setTemplateFile($file)
243255
}
244256

245257

246-
private function setDefaultsValues()
258+
private function loadData()
247259
{
248260
$data = $this->getData();
249261

@@ -260,7 +272,7 @@ private function setDefaultsValues()
260272

261273
public function render()
262274
{
263-
$this->setDefaultsValues();
275+
$this->loadData();
264276

265277
$template = $this->template;
266278
$template->_form = $template->form = $this->getComponent('form');

0 commit comments

Comments
 (0)