{"action":"created","issue":{"url":"https://api.github.com/repos/wbraganca/yii2-dynamicform/issues/31","repository_url":"https://api.github.com/repos/wbraganca/yii2-dynamicform","labels_url":"https://api.github.com/repos/wbraganca/yii2-dynamicform/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/wbraganca/yii2-dynamicform/issues/31/comments","events_url":"https://api.github.com/repos/wbraganca/yii2-dynamicform/issues/31/events","html_url":"https://github.com/wbraganca/yii2-dynamicform/issues/31","id":69133130,"number":31,"title":"Multiple nested widget example","user":{"login":"wennaspeedy","id":10447994,"avatar_url":"https://avatars.githubusercontent.com/u/10447994?v=3","gravatar_id":"","url":"https://api.github.com/users/wennaspeedy","html_url":"https://github.com/wennaspeedy","followers_url":"https://api.github.com/users/wennaspeedy/followers","following_url":"https://api.github.com/users/wennaspeedy/following{/other_user}","gists_url":"https://api.github.com/users/wennaspeedy/gists{/gist_id}","starred_url":"https://api.github.com/users/wennaspeedy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wennaspeedy/subscriptions","organizations_url":"https://api.github.com/users/wennaspeedy/orgs","repos_url":"https://api.github.com/users/wennaspeedy/repos","events_url":"https://api.github.com/users/wennaspeedy/events{/privacy}","received_events_url":"https://api.github.com/users/wennaspeedy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2015-04-17T12:50:57Z","updated_at":"2016-04-03T12:20:44Z","closed_at":null,"body":"It's possible to send me any example of deeper scenario with mutiple nested widget?\r\n\r\n\"Here's could be hypothetical scenario:\r\nA PERSON can have many HOUSES,\r\neach house, can have multiple ROOMS.\"\r\n\r\nThank you."},"comment":{"url":"https://api.github.com/repos/wbraganca/yii2-dynamicform/issues/comments/204958007","html_url":"https://github.com/wbraganca/yii2-dynamicform/issues/31#issuecomment-204958007","issue_url":"https://api.github.com/repos/wbraganca/yii2-dynamicform/issues/31","id":204958007,"user":{"login":"IvanFloripa","id":6644786,"avatar_url":"https://avatars.githubusercontent.com/u/6644786?v=3","gravatar_id":"","url":"https://api.github.com/users/IvanFloripa","html_url":"https://github.com/IvanFloripa","followers_url":"https://api.github.com/users/IvanFloripa/followers","following_url":"https://api.github.com/users/IvanFloripa/following{/other_user}","gists_url":"https://api.github.com/users/IvanFloripa/gists{/gist_id}","starred_url":"https://api.github.com/users/IvanFloripa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IvanFloripa/subscriptions","organizations_url":"https://api.github.com/users/IvanFloripa/orgs","repos_url":"https://api.github.com/users/IvanFloripa/repos","events_url":"https://api.github.com/users/IvanFloripa/events{/privacy}","received_events_url":"https://api.github.com/users/IvanFloripa/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T12:20:44Z","updated_at":"2016-04-03T12:20:44Z","body":"Can anyone help me I'm creating a register of po and po_item but to update the registry items is not bringing the records on the screen and I can not even perform the update in databse.\r\n**I'm new to yii if possible a basic example that someone can help me how to use the dynamic form to save and edit a grid**\r\n```\r\npublic function actionUpdate($id)\r\n    {\r\n        $model = $this->findModel($id);\r\n        $modelsPoItem = MissaoGrupo::findAll(['id' => $oldGrupoIds]);;\r\n        if ($model->load(Yii::$app->request->post()) && $model->save()) {\r\n            return $this->redirect(['view', 'id' => $model->id]);\r\n        } else {\r\n            return $this->render('update', [\r\n                'model' => $model,\r\n                'modelsPoItem' => (empty($modelsPoItem)) ? [new PoItem] : $modelsPoItem\r\n            ]);\r\n        }\r\n    }\r\n```\r\n\r\n```\r\n<div class=\"po-form\">\r\n\r\n    <?php $form = ActiveForm::begin(['id' => 'dynamic-form']); ?>\r\n    \r\n    <?= $form->field($model, 'po_no')->textInput(['maxlength' => 10]) ?>\r\n    <?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>\r\n\r\n\t<div class=\"row\">\r\n\t\t<div class=\"panel panel-default\">\r\n        <div class=\"panel-heading\"><h4><i class=\"glyphicon glyphicon-envelope\"></i> Po Items</h4></div>\r\n        <div class=\"panel-body\">\r\n             <?php DynamicFormWidget::begin([\r\n                'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus \"_\" [A-Za-z0-9_]\r\n                'widgetBody' => '.container-items', // required: css class selector\r\n                'widgetItem' => '.item', // required: css class\r\n                'limit' => 10, // the maximum times, an element can be cloned (default 999)\r\n                'min' => 1, // 0 or 1 (default 1)\r\n                'insertButton' => '.add-item', // css class\r\n                'deleteButton' => '.remove-item', // css class\r\n                'model' => $modelsPoItem[0],\r\n                'formId' => 'dynamic-form',\r\n                'formFields' => [\r\n                    'po_item_no',\r\n                    'quantity',\r\n                ],\r\n            ]); ?>\r\n            <div class=\"container-items\"><!-- widgetContainer -->\r\n            <?php foreach ($modelsPoItem as $i => $modelPoItem): ?>\r\n\r\n                <div class=\"item panel panel-default\"><!-- widgetBody -->\r\n                    <div class=\"panel-heading\">\r\n                        <h3 class=\"panel-title pull-left\">Po Item</h3>\r\n                        <div class=\"pull-right\">\r\n                            <button type=\"button\" class=\"add-item btn btn-success btn-xs\"><i class=\"glyphicon glyphicon-plus\"></i></button>\r\n                            <button type=\"button\" class=\"remove-item btn btn-danger btn-xs\"><i class=\"glyphicon glyphicon-minus\"></i></button>\r\n                        </div>\r\n                        <div class=\"clearfix\"></div>\r\n                    </div>\r\n                    <div class=\"panel-body\">\r\n                        <?php\r\n                            // necessary for update action.\r\n                            if (! $modelPoItem->isNewRecord) {\r\n                                echo Html::activeHiddenInput($modelPoItem, \"[{$i}]id\");\r\n                            }\r\n                        ?>\r\n                        <div class=\"row\">\r\n                            <div class=\"col-sm-6\">\r\n                                \r\n                                <?= $form->field($modelPoItem, \"[{$i}]po_item_no\")->textInput(['maxlength' => 128]) ?>\r\n                            </div>\r\n                            <div class=\"col-sm-6\">\r\n                                <?= $form->field($modelPoItem, \"[{$i}]quantity\")->textInput(['maxlength' => 128]) ?>\r\n                            </div>\r\n                        </div><!-- .row -->\r\n                    </div>\r\n                </div>\r\n            <?php endforeach; ?>\r\n            </div>\r\n            <?php DynamicFormWidget::end(); ?>\r\n        </div>\r\n        </div>\r\n\t</div>\r\n    <div class=\"form-group\">\r\n        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>\r\n    </div>\r\n\r\n    <?php ActiveForm::end(); ?>\r\n\r\n</div>\r\n```\r\n"}}