0

I have in the AppAsset.php file the following...

public $js = [
    'template/js/bootstrap.js',
];

public $depends = [
    'yii\web\YiiAsset',
    'yii\bootstrap\BootstrapAsset',
];

It is working properly but when I call the kartik gridview, it automatically calls another bootstrap.js file so there are two bootstrap in the document that causes bootstrap modal to disappear instantly after showing.

How to prevent the widget from calling the bootstrap.js so? Do i need to just comment the above code and register bootstrap.js to every views that needs it?

beginner
  • 2,024
  • 5
  • 43
  • 76

2 Answers2

0

The given code add bootstrap css as well as js.

public $depends = [
 'yii\bootstrap\BootstrapPluginAsset',
];

So no need to add below

public $js = [
'template/js/bootstrap.js',

];

ToJ
  • 155
  • 7
0

Finally found the soution

public $js = [

];
public $depends = [
    'yii\web\YiiAsset',
    'yii\bootstrap\BootstrapPluginAsset',
];
Liam
  • 536
  • 8
  • 23