yii2 pjax inside other pjax

i have form with two pjax. (one inside two) when clicked link in second PJAX send query to server but in field "X-PJAX-Container" write ID first container.

Pjax::begin([
    'id' => 'register-form'
    ]);

...

Pjax::begin([
    'id' => 'que'
    ]);

echo yii\helpers\Html::a('update', ['/portal/que/gr-usl/');

Pjax::end();

...

Pjax::end();

location after click update : /portal/que/gr-usl?_pjax=%23register-form

request header

X-PJAX:true
X-PJAX-Container:#register-form
X-Requested-With:XMLHttpRequest

if set data-pjax for link #que request header not changed.

Upvotes: 0

Views: 1038

Answers (1)

for all link in inside pjax disabled data-pjax an href change to onclick with function

$.pjax({url: $(el).attr('link'), container: '#pjax-grusl'});

links has code

echo yii\helpers\Html::a('update', null,[
        'data-pjax' => 'false',
        'link' => \yii\helpers\Url::to(['/portal/que/gr-usl/',
            'ids'    => $ids,
            'filter' => $filter,
            'gr'     => $gr
        ]),
        'onclick' => 'selGr(this)'
    ]);

but its should work from box :( i don't understand why click by link don't find first pjax container from dom tree.

Upvotes: 0

Related Questions