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

Undefined index: filterModel #30

Closed evgen-d closed 10 years ago

evgen-d commented 10 years ago

If I use DynaGrid without filterModel, I get the following message:

PHP Notice – yii\base\ErrorException

Undefined index: filterModel
1. in /home/evgen-d/project/application/vendor/kartik-v/yii2-dynagrid/DynaGrid.php at line 642

    /**
     * Applies the grid filter
     */
    protected function applyFilter()
    {
        $class = get_class($this->gridOptions['filterModel']);
        if (!empty($this->_detailConfig[DynaGridStore::STORE_FILTER]) && empty($_GET[$class])) {
            $attributes = $this->_detailConfig[DynaGridStore::STORE_FILTER];
            $searchModel = $this->gridOptions['filterModel'];
            $searchModel->setAttributes($attributes);
            $this->gridOptions['filterModel'] = $searchModel;
            $this->initDataProvider($searchModel);
        }
    }