renderAjax

Does anyone have any idea why renderAjax breaks my CSS? Everytime I do a renderAjax my buttons change colors to default even though I have the .css file in AppAssets.php. I have switched back to renderPartial and its all good now but widgets are not initialized. Any pointers for a noobie like me would be helpful.

Thanks,

Brendan

Probably the style for the buttons is overwritten in the CSS files that you are inserting with renderAjax.

http://www.yiiframework.com/doc-2.0/guide-structure-views.html#rendering-in-controllers

Note that CSS files are registered to certain views. And I guess that some important CSS is not registered to the view that you are rendering with renderAjax.

Thanks for the link. I’ve read that before and its helpful indeed.

main.php - layout

raoul2000\bootswatch\BootswatchAsset::$theme = ‘cosmo’;

My AppAsset file is super clean… I use main.php for my layout file and everything else is rendered via renderPartial and renderAjax. When I use renderAjax for some reason it does not appear to use the css from my main.php file. I’ve got no idea why except to think its a renderAjax bug.

Any other pointers would be helpful.

See whats happening here.

Thanks in advance.

Your AppAsset is registered to the layout view (main.php), and is not registered to the partial view that you are rendering using renderAjax. Am I right? Then the css files in AppAsset will not be sent to the user’s browser. Try including the necessary css files in the asset you are registering to the partial view for renderAjax.