Closed svetlika closed 1 year ago
Set bsVersion
to 5.x
in your Yii2 config params file and try.
Thanks, it helped. Now this widgets works separately on the page.
P.S. I also have discovered, that these widgets works inside the grid without putting param "bsVersion" into my config params.
Hi!
I want to use kartik\select2 widget in my Yii2 project, so I install it via composer and place into my view the example from documentation and get this error:
Not instantiable – yii\di\NotInstantiableException Failed to instantiate component or class "yii\bootstrap\BootstrapAsset". ↵ Caused by: ReflectionException Class yii\bootstrap\BootstrapAsset does not exist
The example which doesn't work is
I use Bootstrap 5 and on that page I also use another kartik widget - kartik DatePicker for the filter in kartik GridView. And they both (gridview and datepicker) are working, although I have some troubles with the kartik gridview at the beginning- there was an error with bootstrap dropdown, but when I place the hidden div with id="w0" the js error dissapeared.
Anyway, they are working fine, but kartik widget Select2 - doesn't work at all.
As I understand, this widget couldn't find the bootstrap assets, but I don't understand why and what to do. I couldn't find any information about this or similar issue, so I decided to write it. Could you please help me? I am new to Yii2.
My AppAsset looks like this:
And my composer.json now looks like this, because I try to install Select2 separately and after I try to install it with all widgets, but none of them is working (kartik\selet2\select2 or kartik\widgets\select2). I tried also to use other widget from this widgets pack (kartik/fileInput) and it generated the same error.
By the way, If I remove option "bsVersion" from the widget params, then I get another error:
You must install 'yiisoft/yii2-bootstrap' extension for Bootstrap 3.x version support. Dependency to 'yii2-bootstrap' has not been included with 'yii2-krajee-base'. To resolve, you must add 'yiisoft/yii2-bootstrap' to the 'require' section of your application's composer.json file and then run 'composer update'.
Can you tell me what I am doing wrong here, please?