Pjax

I just don’t get how to use it. I understand it’s a ajax. But…

Is it just for update some blocks on the same page without refresh?

Given a grid (I use kartik’s one), do some filters, selections, sorting on it. Now I click on Create button and create a new record.

The question is how to return back to that grid that I just sorted/filtered/arranged ? Is pjax usefull for that?

Pjax executes:

  1. make an ajax request;

  2. get specified part of html response;

  3. replace same part in the current html code with the extract;

You can reproduce pjax with your code, but why reinvent the wheel?

I don’t what to reinvent the wheel, just want to use it the right way.

I just want to keep the grid sorted/filtered after a new record is created and returned to the grid.

So any good docs or tutorials about Pjax?

you can try


return $this->redirect(Yii::$app->request->referrer);

And that will return back to a grid that was filtered/sorted ?