jQuery(...).yiiGridView 不是一个函数 [英] jQuery(...).yiiGridView is not a function

查看:28
本文介绍了jQuery(...).yiiGridView 不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Yii 网格视图时遇到问题.出于某种原因,它似乎没有正确加载,即使包含了脚本(我可以在源代码中看到它).这是 HTML 的标题部分:

I have a problem with Yii grid view. for some reason it does not seem to load correctly, even though the script is included (i can see it in the source code). This is the header part 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>

我收到错误:TypeError: jQuery(...).yiiGridView is not a function

您知道问题可能出在哪里吗?

Any ideas where the problem may lie?

推荐答案

我发现了问题.

实际上问题是,不知何故,我在页面中包含了 2 次 jquery - 第二次在页脚中,这就是为什么我没有找到我们之前的.

Actually the problem was, somehow i got jquery included 2 times in the page - the 2nd time in the footer, that is why I did't find our earlier.

jquery 只需要在页面中出现 1 次,并且需要在 header 中.

Jquery needs to be only 1 time in the page, and it needs to be in the header.

这篇关于jQuery(...).yiiGridView 不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆