Answer the question
In order to leave comments, you need to log in
Pjax request on input event is not possible?
I have a form, when submitting it, a pjax request is made to the server, which returns the content to me, but how can I make the request be made on the input event?
view:
<div class="client-index">
<div class="col-xs-2">
<h3 style="margin-top:0px"><?= Yii::t('app', 'Search title') ?></h3>
<div class="row-fluid">
<?= $this->render('_search', [
'model' => $searchModel
])?>
</div>
</div>
<div class="col-xs-10" id="clients_list">
<h3 style="margin-top:0px"><?= Html::encode($this->title) ?></h3>
<div class="row-fluid">
<p>
<?= Html::a(Yii::t('app', 'Create client'), ['create'], ['class' => 'btn btn-success', 'id' => 'create_client']) ?>
</p>
</div>
<?
// \yii\widgets\Pjax::begin(['id' => 'list_client']);
echo 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']);
}
]);
// \yii\widgets\Pjax::end();
?>
</div>
</div>
jQuery(document).pjax("#pjax_inner a", "#pjax_inner", {"push":true,"replace":false,"timeout":"20000","scrollTo":false});
jQuery(document).on('submit', "#pjax_inner form[data-pjax]", function (event) {jQuery.pjax.submit(event, '#pjax_inner', {"push":true,"replace":false,"timeout":"20000","scrollTo":false});});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question