I work on my first project on Yii2 and I’m a bit stuck.
I’m trying to use Pjax to load several page segments (stream, profile-data, photos, friends…) for a User profile page on my website.
This works fine for some segments but some of them register Js files using the yii\web\AssetBundle class and they don’t register with Pjax reload.
I think this is normal since Pjax only reloads a page segment and AssetBundle registers the Js files in 3 different positions ([POS_HEAD],[POS_BEGIN],[POS_END]) which are out of the reloaded segment.
My question is : How can I make this work?
I have some "bad" ideas in my opinion :
Maybe there is a way to add a custom position which would be inside the page segment reloaded with Pjax but that would mean modify Yii2 files.
Register the Js inline but this would be so ugly.
I guess there is a soft way to do this.
Thank you !