Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // presenter render
- $this->template->data = $data;
- // presenter form
- protected function createComponentTableForm()
- {
- $form = new UI\Form();
- $form->addDynamic('rows', function ($container) {
- $container->addCheckbox('select');
- });
- $form->addSubmit('delete', 'Smazat');
- return $form;
- }
- // sablona
- {form tableForm}
- <tr n:foreach="$data as $id => $row">
- <td>{control rows-$id-select}</td>
- <td n:foreach="$row as $key => $value">{$value}</td>
- </tr>
- {control delete}
- {/form}
- // zpracovani
- public function Submitted($form)
- {
- $ids = array_keys(array_filter(function ($row) {
- return $row['select'];
- }, (array)$form->rows->values));
- }
Advertisement
Add Comment
Please, Sign In to add comment