Yii2 nested pjax

I have a tabbed page (actually these are links processed by parent pjax). Which loads the contents of the tab through pjax calls.

In one of the tabs, I have a gridview that is inside the pjax container. This makes it nested. The problem is that the attached file when loading and pasting into the page does not include its own javascript ie:

jQuery(document).pjax("#history-gridview a", "#history-pjax", {"push":true,"replace":false,"timeout":5000,"scrollTo":false}); 
+5
source share
1 answer

When you request a tab page (or content) you need to call renderAjax() . I am doing something like this:

 if (Yii::$app->request->isAjax) return $this->renderAjax('myview'); else return $this->render('myview'); 

However, this may not solve your problem. I found that if I move tabs , and the table is dynamically loaded on the tab (with its own pjax container), then any interaction with sorting and grid filters tries to reload from the external (pjax tab) container, even with skipOuterContainers set to true .

On the side of the note, developers are thinking of full support for pjax like here , as well as how asset packages work.


The question remains:

How to create ultra-fast performance, for example, SPA (single-page application) without Angular2 or similar? The mesh container in the tab container is an ideal example, which if it could be reached (back / forward buttons, initialization scripts) would be great.

0
source

All Articles