|
14 | 14 | use Nette\Forms\Container; |
15 | 15 | use Nette\Forms\Controls\Button; |
16 | 16 | use Nette\Forms\Controls\Checkbox; |
| 17 | +use Nette\Localization\ITranslator; |
17 | 18 | use Nette\Utils\Html; |
18 | 19 | use Nette\Utils\Paginator; |
19 | | -use Nette\Localization\ITranslator; |
20 | | - |
21 | 20 |
|
22 | 21 | class Datagrid extends UI\Control |
23 | 22 | { |
@@ -102,6 +101,11 @@ class Datagrid extends UI\Control |
102 | 101 | /** @var string */ |
103 | 102 | protected $filterFormHttpMethod = 'post'; |
104 | 103 |
|
| 104 | + /** @var string */ |
| 105 | + protected $globalActionSelectPrompt = '- select action -'; |
| 106 | + |
| 107 | + /** @var string */ |
| 108 | + protected $globalActionProcessLabel = 'Do'; |
105 | 109 |
|
106 | 110 | /** |
107 | 111 | * Adds column |
@@ -282,6 +286,22 @@ public function translate($s, $count = null) |
282 | 286 | : $translator->translate((string) $s, $count); |
283 | 287 | } |
284 | 288 |
|
| 289 | + /** |
| 290 | + * @param string $globalActionSelectPrompt |
| 291 | + */ |
| 292 | + public function setGlobalActionSelectPrompt($globalActionSelectPrompt) |
| 293 | + { |
| 294 | + $this->globalActionSelectPrompt = $globalActionSelectPrompt; |
| 295 | + } |
| 296 | + |
| 297 | + /** |
| 298 | + * @param string $globalActionProcessLabel |
| 299 | + */ |
| 300 | + public function setGlobalActionProcessLabel($globalActionProcessLabel) |
| 301 | + { |
| 302 | + $this->globalActionProcessLabel = $globalActionProcessLabel; |
| 303 | + } |
| 304 | + |
285 | 305 |
|
286 | 306 | /*******************************************************************************/ |
287 | 307 |
|
@@ -488,9 +508,9 @@ public function createComponentForm() |
488 | 508 | $actions = array_map(function($row) { return $row[0]; }, $this->globalActions); |
489 | 509 | $form['actions'] = new Container(); |
490 | 510 | $form['actions']->addSelect('action', 'Action', $actions) |
491 | | - ->setPrompt('- select action -'); |
| 511 | + ->setPrompt($this->globalActionSelectPrompt); |
492 | 512 | $form['actions']->addCheckboxList('items', '', []); |
493 | | - $form['actions']->addSubmit('process', 'Do'); |
| 513 | + $form['actions']->addSubmit('process', $this->globalActionProcessLabel); |
494 | 514 | } |
495 | 515 |
|
496 | 516 | if ($this->translator) { |
|
0 commit comments