I'll try to answer as I would.We have a controller with actions. One action depicts the page's penetration, the second act gives only a content that depicts the view with the specified parameters.public function actionPage()
{
$dataProvider = ...;
return $this->render('page', [
'dataProvider' => $dataProvider,
'id' => $id,
'checked' => $checked,
]);
}
public function actionReloadWidget($id, $checked)
{
return $this->render('widget', [
'id' => $id,
'checked' => $checked,
]);
}
Next's in the page, we'll get the right content and the second drink that draws the content of the view.bla bla content
<?= $this->render('widget', [
'id' => $id,
'checked' => $checked,
])?>
bla bla content
And in the widget, it's a view that will accept the parameters and draw the necessary content.<?php Pjax::begin(); ?>
<?= Html::a("Update widget", ['site/reload-widget'], ['class' => 'btn btn-lg btn-primary']) ?>
<div class="">
<?= \app\widgets\UserWidget::widget([
'params' => [
'id' => $id,
'checked' => $checked,
]
])?>
</div>
<?php Pjax::end(); ?>
It turns out that when we get on the site/page page, the hammer will draw, and when we roll on the button, the request goes on the site/reload-widget and pulls the content from the bucket that only has the view of the UserWidget. The content will be updated in the place we took to Pjax.We don't forget the excitement to send the data to the flashing bag. Implementation may not be the best, but I just wanted to show you the mechanism. If data for the design of the view should be transmitted from the page, the input form may be added to the Pjax and the data can be transmitted. https://p0vidl0.info/yii2-vnikaem-v-pjax.html ♪UP 10.08.18It's easy to get confused in that code.Don't make a model in a bucket. Do it in the control room, get the mass and hand it over to the drink. The shot just paints the data.Make references Url::to(['/controller/action', 'foo' => 'bar'])Thank you.If you cut the line \yii\helpers\StringHelper::truncate($body,300,'...');If you withdraw the list, why not use the ListView?Certify through AccessControl by adding it to behaviors in the counteraller. Or are you gonna write the same thing in every eccleus?Steal the escene Iphs to the model or service. The counterall received the data, handed them to the bush and everything.When I see $status=" and flg_close=0 ";I know it's bad.It's for a shake, so you don't relax. It's hard to figure out what's going on and what's going on, so I'm suggesting we do it in stages. Do two clean echelons and two drinks for them in the same control room (as I described above). Do a temporary data set and hand it over from the escen to the bucket, and put it on the list. And in the second excheon, which is to be updated, make another set, and also hand it over to the drink.