Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replikator nereplikuje Dynamic v Dynamicu #49

Open
FilipLukac opened this issue May 2, 2017 · 1 comment
Open

Replikator nereplikuje Dynamic v Dynamicu #49

FilipLukac opened this issue May 2, 2017 · 1 comment

Comments

@FilipLukac
Copy link

FilipLukac commented May 2, 2017

Ahoj,

mam problem s replikatorom ked mam strukturu takuto:

$form->addDynamic('inputsContainer', function (Container $container) use ($translator, $addCallback) {
            $months = [];
            for ($m = 1; $m <= 12; $m++) {
                $months[] = date('F', mktime(0, 0, 0, $m, 1, date('Y')));
            }
            $start = (new DateTime())->modify('-4 years');
            $end = (new DateTime())->modify('+4 years');

            $years = Date::getYearsBetweenInterval($start, $end);

            $container->addMultiSelect('months', $translator->translate('forms.kpi.createForm.months'), $months)
                ->getControlPrototype()->addClass('js-example-basic-multiple');

            $container->addSelect('years', $translator->translate('forms.kpi.createForm.years'), $years);
            $container->addDynamic('inputs', function (Container $inputs) use ($translator) {
                $inputs->addText('targetName', $translator->translate('forms.kpi.createForm.labels.name'));

                $inputs->addText('interval', $translator->translate('forms.kpi.createForm.labels.interval'))
                    ->setRequired(FALSE)
                    ->addRule(Form::NUMERIC);



                $inputs->addText('color', $translator->translate('forms.kpi.createForm.labels.color'))
                    ->getControlPrototype()
                    ->addClass('colorpicker')
                    ->setAttribute('autocomplete', 'off');
            }, 6);
            $container->addSubmit('remove', 'Remove period')
                ->setValidationScope(FALSE)
                ->addRemoveOnClick();
        }, 1)->addSubmit('add', 'Add period')
            ->setValidationScope(FALSE)->addCreateOnClick();

potrebujem ale, ked sa zavola addCallback(); aby sa zreplikoval aj container inputs - momentalne sa mi zreplikuje iba container inputsContainer

vies mi nejako pomoct ?

Nette 2.4
replicator@dev

PS: Prva forma sa mi vykresli OK, so 6 prvkami

@FilipLukac
Copy link
Author

Riesenie je:

$form->addDynamic('name', function(Container $name){}, $defaultContainers, TRUE);

cize posledny parameter na TRUE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant