diff --git a/views/blog-article/_form.php b/views/blog-article/_form.php index 4ac9c08..3b9e403 100755 --- a/views/blog-article/_form.php +++ b/views/blog-article/_form.php @@ -135,6 +135,11 @@ ?> id )) { + $data = 'function(params) { return {q:params.term}; }'; + } else { + $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }'; + } echo $form->field($model, 'blogArticles') ->widget( Select2::className(), @@ -156,7 +161,7 @@ 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), 'dataType' => 'json', 'data' => new JsExpression( - 'function(params) { return {q:params.term, id:' . $model->id . '}; }' + $data ), ], 'templateResult' => new JsExpression('function(article) { return article.text; }'), -- libgit2 0.21.4