yiqing95, Thank you for your solution!
To be honest I did not want to change the Core Yii Bootstrap.
But apparently it is the only way to solve the problem agree?
Well, the good news is that solved the problem.
Below is the steps that were made:
I added the extension
NLSClientScript to the project.
Adding it, solved the problem with scripts.
Now let's resolution CSS.
In Bootstrap.php:
// I created a new property.
/**
* @var boolean to register the Bootstrap in AJAX requests
* Defaults to true.
*/
public $ajaxCssImport = true;
// And added the following conditional
if(($this->ajaxCssImport && Yii::app()->request->isAjaxRequest) || !Yii::app()->request->isAjaxRequest ) {
// Prevents the extension from registering scripts and publishing assets when ran from the command line.
if (Yii::app() instanceof CConsoleApplication)
return;
if ($this->coreCss !== false)
$this->registerCoreCss();
if ($this->responsiveCss !== false)
$this->registerResponsiveCss();
if ($this->yiiCss !== false)
$this->registerYiiCss();
}
if ($this->enableJS !== false)
$this->registerCoreScripts();
In main.php
'bootstrap' => array(
'class' => 'ext.bootstrap.components.Bootstrap',
'ajaxCssImport' => false,
),
With that solved my problem.
Anyway you had spoken...
// added by yiqing95
if(Yii::app()->getRequest()->getIsAjaxRequest()){
//if is ajax mode shouldn't register css and js files again !
return ;
}
It does not solve the problem.
The CSS files are not loaded, but the AJAX code that is generated by the view that is being called, is not.
So below is outside the conditional parole that I created.
if ($this->enableJS !== false)
$this->registerCoreScripts();
And adding the extension "NLSClientScript" was necessary because the other JS files, including "bootstrap.js" remained loaded.
Well, that's it, I was happy to resolve the issue and then let the new amendment as a suggestion for a future version of "Yii Bootstrap".
Thanks to everyone who helped me troubleshoot.