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

Apply unset theme #73

Closed joester89 closed 9 years ago

joester89 commented 9 years ago

If a user would changes the theme in the cookie, or after a time you change the themes you provide for the DynaGrid could cause the problem that a theme is saved that doesn't exist anymore. When loading the theme (as in https://github.com/kartik-v/yii2-dynagrid/blob/master/DynaGrid.php#L920) causes an exception.

A solution could be that if you try to load a theme that doesn't exist in your theme config, load the default theme:

    $theme = ArrayHelper::getValue($this->_module->themeConfig, $this->theme, $this->_module->defaultTheme);

If no defaultTheme is set, this still works.