2

I have a problem that appears from including BootstrapPluginAsset before JuiAsset. (Link: Uncaught Error: cannot call methods on button prior to initialization; attempted to call method 'loading').

Since the \yii\web\BootstrapPluginAsset only have dependency to yii\web\JqueryAsset and yii\bootstrap\BootstrapAsset not \yii\jui\JuiAsset (link), how to make sure that \yii\jui\JuiAsset will always be included before yii\bootstrap\BootstrapAsset?

Community
  • 1
  • 1
Petra Barus
  • 3,815
  • 8
  • 48
  • 87

1 Answers1

1

When you include multiple CSS or JavaScript files in a Web page, they have to follow a certain order to avoid overriding issues. For example, if you are using a jQuery UI widget in a Web page, you have to make sure the jQuery JavaScript file is included before the jQuery UI JavaScript file. We call such ordering the dependencies among assets.

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

http://www.yiiframework.com/forum/index.php/topic/69670-how-to-force-jquery-ui-asset-always-included-before-bootstrap-plugin-asset-in-yii2/page__view__findpost__p__295772

Jonnny
  • 4,939
  • 11
  • 63
  • 93