Search code examples
javascriptjqueryyiiyii-booster

booster have conflict in yii by jquery


I am using extention booster in simple project yii,I think booster has conflict in yii project, I could add booster to my project but I have error to all page in browser console:
for example , CGridview of filter don't work or other my jquery owner function don't work too.
error in firefox console:

TypeError: jQuery(...).popover is not a function

jQuery('[data-toggle=popover]').popover();

error in chorom console: enter image description here

How can remove my problem, I added only a jquery (version 9).


Solution

  • I'm sorry for those who gave negative Unreasonable.
    There are some step for resolve:
    1- remove default yii jquery.
    2- add new jquery top of 9 version.
    but you should not add new jquery to header.php.
    You must to add jquery to config/main.php and do other configuration.

    main.php

     'components' => array(
    ...
    'clientScript' => array(
            'scriptMap' => array(
                'jquery.js'=>false,  //disable default implementation of jquery
                'jquery.min.js'=>false,  //desable any others default implementation
                'core.css'=>false, //disable
                'styles.css'=>false,  //disable
                'pager.css'=>false,   //disable
                'default.css'=>false,  //disable
            ),
            'packages'=>array(
                'jquery'=>array(                             // set the new jquery
                    'baseUrl'=>'js/',
                    'js'=>array('jquery9.js'),
                ),
                'bootstrap'=>array(                       //set others js libraries
                    'baseUrl'=>'bootstrap/',
                    'js'=>array('js/bootstrap.min.js'),
                    'css'=>array(                        // and css
                        'css/bootstrap.min.css',
                        'css/custom.css',
                        'css/bootstrap-responsive.min.css',
                    ),
                    'depends'=>array('jquery'),         // cause load jquery before load this.
                ),
            ),
        ),
    
    ...
    ),
    

    It makes jquery9 placed above the rest jquery files.

     'depends'=>array('jquery'),         // cause load jquery before load this.