JQuery (...). yiiGridView is not a function

I have a problem with the Yii grid. for some reason it doesn't seem to load correctly even if the script is enabled (I see it in the source code). This is the header of the HTML:

<script src="fileadmin/static/js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="/module/public/assets/80c0553/gridview/jquery.yiigridview.js" type="text/javascript"></script>
<script type="text/javascript">jQuery(function($) {
 jQuery('#grid-downloads').yiiGridView({'ajaxUpdate':['grid-downloads'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'def-table','selectableRows':1,'enableHistory':false,'updateSelector':'{page}, {sort}','filterSelector':'{filter}','pageVar':'page'}); 
 });
</script>

I get an error message: TypeError: jQuery(...).yiiGridView is not a function

Any ideas you might have a problem in?

+5
source share
2 answers

I found a problem.

Actually the problem was that somehow I got jquery included 2 times on the page - the second time in the footer, so I did not find ours before.

Jquery should only be 1 time per page, and it should be in the header.

+10
source

, jquery js, public, , 'yii\web\JqueryAsset',

0

All Articles