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

setting YII_DEBUG to false in web/index.php causes dynagrid error #156

Closed gvasilopulos closed 7 years ago

gvasilopulos commented 7 years ago

Prerequisites

Steps to reproduce the issue

  1. turn debug off on yii
  2. reload a dynagrid enables page all select2 filters end up loading forever
  3. Expected behavior and actual behavior

When I follow those steps, I see... select2 filter loading forever I was expecting... normal loading as it happens with YII_DEBUG true on browser console 2 errors pop up SyntaxError: function statement requires a name kv-dynagrid-detail.min.js:14:11 TypeError: jQuery(...).dynagridDetail is not a function index.php:1414:0 line 1414 is as follows jQuery('#dynagrid-product-filter-key').dynagridDetail({"submitMessage":"<div class=\"dynagrid-submit-message\">Εφαρμογή και αποθήκευση ρυθμίσεων &hellip;</div>","deleteMessage":"<div class=\"dynagrid-submit-message\">Διαγραφή όλων των ρυθμίσεων χρήστη &hellip;</div>","deleteConfirmation":"Ειστε βέβαιοι ότι θέλετε να διαγράψετε την ρύθμιση;","configUrl":"/ppf/orders/index.php?r=dynagrid%2Fsettings%2Fget-config","modalId":"dynagrid-product-filter-modal","dynaGridId":"dynagrid-product"});

Environment

Browsers

Operating System

Libraries

junaid-rahman commented 7 years ago

I m also facing same issue after debugging i got the exact problem, problem is on generating kv-dynagrid-detail.min.js file

this issue will not be appearing in debugging mod because inside BaseAssetBundle.php file there is code for setting up the assets that is pasted below

protected function setupAssets($type, $files = []) { . if ($this->$type === self::KRAJEE_ASSET) { .. $srcFiles = []; .. $minFiles = []; .. foreach ($files as $file) { ... $srcFiles[] = "{$file}.{$type}"; ... $minFiles[] = "{$file}.min.{$type}"; .. } .. $this->$type = YII_DEBUG ? $srcFiles : $minFiles; . } elseif ($this->$type === self::EMPTY_ASSET) { .. $this->$type = []; . } }

this code says that if debugging is on then register .js file else register .min.js file, Error is actually in the .min.js file hence your getting this issue when debugging mode is turned off,

The error what i found is just missing an " ! " symbol

I found that while comparing kv-dynagrid.min.js and kv-dynagrid-detail.min.js files

starting content of kv-dynagrid.min.js !function(e){"use strict";var t=function(t,i){return null=...........................

starting content of kv-dynagrid-detail.min.js function(e){"use strict";var t=function(t,n){return null=...........................

Now my problem has been solved by adding that missing ! symbol to the kv-dynagrid-detail.min.js file.

But i cant change that original file since it in the vendor folder, vendor folder is git ignored so changes in that folder will not be pushed in to my git server, so for the timing i just modified the backend/web/assets cache file, but now every time when i clear the cache i have to re-edit it,

Now i am trying to override its DynaGridAsset.php asset file,

but it will be helpful if an update with this minor bug fixing is provided

junaid-rahman commented 7 years ago

actually this issue is not present in v.1.4.4, better you include v.1.4.4 in your composer file until the new release