From 31b414bd55940c07ce79bb036d0faf1aae0798ad Mon Sep 17 00:00:00 2001 From: Ariel Braun Date: Mon, 19 Dec 2016 17:53:12 +0200 Subject: [PATCH] fix some bugs --- README.md | 13 +++++++++++++ actions/AppendAction.php | 2 +- actions/DeleteAction.php | 2 +- js/js.js | 1 + views/repeater.php | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4695c2f..65c7527 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,16 @@ public function actions() ]; } ``` +And this is an example of the repeater_view_file.php reminded above: +``` +
+
+ + 'form-control']) ?> +
+
+ + 'form-control']) ?> +
+
+``` \ No newline at end of file diff --git a/actions/AppendAction.php b/actions/AppendAction.php index e78d962..f5d4af2 100644 --- a/actions/AppendAction.php +++ b/actions/AppendAction.php @@ -27,6 +27,6 @@ public function run() $id = \Yii::$app->request->post('id'); $model = new $this->model(); // $model = $model::findOne($id); - return $this->controller->renderPartial('repeater', ['model' => $model, 'contentPath' => $this->contentPath]); + return $this->controller->renderPartial('repeater', ['model' => $model, 'contentPath' => $this->contentPath, 'k' => $id]); } } \ No newline at end of file diff --git a/actions/DeleteAction.php b/actions/DeleteAction.php index 6b3d889..fc505d5 100644 --- a/actions/DeleteAction.php +++ b/actions/DeleteAction.php @@ -25,7 +25,7 @@ class DeleteAction extends Action public function run() { $id = \Yii::$app->request->post('id'); - $model = $this->model; + $model = $this->model; /** @var ActiveRecord $model */ $model = $model::findOne($id); $response = 0; diff --git a/js/js.js b/js/js.js index 2aaf7c6..9595f74 100644 --- a/js/js.js +++ b/js/js.js @@ -34,6 +34,7 @@ jQuery(function($){ var data ={id:self.id}; data[yii.getCsrfParam()]=yii.getCsrfToken(); data.additionalData = $('.repeater-item').find('input,select,textarea').serialize(); + data.id = self.id; $.post(appendUrl,data, function(data){ $wrap.append($(data)); }); diff --git a/views/repeater.php b/views/repeater.php index 3bbc3da..5ad8594 100644 --- a/views/repeater.php +++ b/views/repeater.php @@ -5,7 +5,7 @@
render($contentPath, ['model' => $model]); + $content = $this->render($contentPath, ['model' => $model, 'k' => $k]); } ?> X