kartik-v / yii2-dynagrid

Turbo charge the Yii 2 GridView with personalized columns, page size, and themes.
http://demos.krajee.com/dynagrid
Other
74 stars 66 forks source link

Bootstrap4 - Class 'yii\bootstrap\Modal' not found #211

Closed adamwinn closed 5 years ago

adamwinn commented 5 years ago

Prerequisites

Steps to reproduce the issue

  1. Configure dynagrid for bootstrap4
  2. Upon page view, error is thrown Class 'yii\bootstrap\Modal' not found
Class 'yii\bootstrap\Modal' not found

    1. in /Users/awinn/Documents/code/htdocs/sbpv4/vendor/kartik-v/yii2-dynagrid/src/views/config.php at line 65
    56575859606162636465666768697071727374

                        <?php
    /**
     * @var \yii\bootstrap\Modal $modalClass
     */
    $modalClass = $isBs4 ? 'yii\bootstrap4\Modal' : 'yii\bootstrap\Modal';
    $hdr = $iconPersonalize . ' ' . Yii::t('kvdynagrid', 'Personalize Grid Configuration');
    $modalOpts = [
        'footer' => $model->footer,
        'toggleButton' => $toggleButtonGrid,
        'size' => Modal::SIZE_LARGE,
        'options' => ['id' => $id],
    ];
    if ($isBs4) {
        $modalOpts['title'] = $hdr;
    } else {
        $modalOpts['header'] = '<h3 class="modal-title">' . $hdr . '</h3>';
    }
    $modalClass::begin($modalOpts);
    ?>

Modal::SIZE_LARGE is referring to the bootstrap3 version of SIZE_LARGE and it cannot be found if only bootstrap4 is installed

kartik-v commented 5 years ago

You need to setup the Bootstrap version for Krajee Widgets. Read the documentation for Dynagrid Bootstrap version setup.

adamwinn commented 5 years ago

I already read the docs and setup dynagrid.

'dynagrid'=>[
            'class'=>'\kartik\dynagrid\Module',
            'defaultPageSize'=>50,
            'maxPageSize'=>200,
            'bsVersion'=>'4.x',
        ],

I had to change use yii\bootstrap\Modal to use yii\bootstrap4\Modal

kartik-v commented 5 years ago

I see. I understand the issue (it is in the views file - recorded a bug ... will check and update).

kartik-v commented 5 years ago

Fixed via latest update. Cross check and let know.

adamwinn commented 5 years ago

It's fixed! Thanks