Prevent Renderajax() From Rendering Bootstrap.css Again

Hello Guys,

I´m using a Bootstrap theme in my project.

When I use renderAjax to render a view with same widget (like kartik\widgets\DatePicker), bootstrap.css is rendered again, and I lost my custom style.

The only way I found to solve this was editing WidgetAsset.php, but It´s not seeing right…

Any other way to solve this?


The renderAjax() method renders a view without applying any layout. But it is supposed to inject all registered JS/CSS scripts and files. Maybe the order of registering is different in your case after the ajax call due to some reason (your theme asset should be registered last and override others). You may want to check that.

Can you try registering your theme assets again in your ajax view?

// view.php


// your other view code

Thanks Kartik, this works!

Now I can use all your extensions!