Answer the question
In order to leave comments, you need to log in
Why does this error occur(Pjax)?
Trying to load ActiveForm via pjax
<? \yii\widgets\Pjax::begin()?>
<div class="client-index">
<h3><?= Html::encode($this->title) ?></h3>
<p>
<?= Html::a(Yii::t('app', 'Create client'), ['create'], ['class' => 'btn btn-success', 'id' => 'create_client']) ?>
</p>
<?= ListView::widget([
'dataProvider' => $dataProvider,
'options' => [
'tag' => 'div',
'class' => 'list-wrapper',
'id' => 'list-wrapper',
],
'layout' => "{summary}\n{pager}\n{items}",
'itemView' => function ($model, $key, $index, $widget) {
return Html::a($model->name, ['/client/view'.'?id='.$model->id], ['class'=>'btn btn-default']);
//return Html::a('button', $model->name, ['type' => 'button', 'class' => 'btn btn-sm btn-default', 'id' => $model->id]);
}
]);
?>
</div>
<? \yii\widgets\Pjax::end() ?>
public function actionCreate()
{
$model = new Client();
$model->user_id = Yii::$app->user->identity->getId();
if (Yii::$app->request->isAjax)
{
return $this->renderAjax('create', [
'model' => $model,
]);
}
Answer the question
In order to leave comments, you need to log in
I solved the problem by connecting js files explicitly, they were not loaded when requested ... or they were loaded incorrectly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question