是什么导致“jqGrid不是一个功能”错误? [英] What causes the "jqGrid is not a function " error?

查看:108
本文介绍了是什么导致“jqGrid不是一个功能”错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级后我遇到问题:


  • jqGrid从3.5.3到3.8.2

  • jquery从1.3.2到1.4.4

  • jquery-ui从1.7.2到1.8.8

我的应用程序有jqueryui选项卡。第三个选项卡有一个jqGrid控件。
如果我在第三个选项卡上进行重新加载,那么网格可以正常工作。但是,如果在第一个选项卡上重新加载然后单击第三个选项卡,则不显示网格。

My application has jqueryui tabs. The third tab has a jqGrid control. If I do a reload while I'm on the third tab then the grid works correctly. However, if do a reload on the first tab and then click the third tab then to grid does not show.

Firebug向我显示jqGrid不是函数错误。

Firebug shows me the "jqGrid is not a function " error.

在论坛中搜索表明问题是grid.loader.js中的pathtojsfiles不正确

Searching in the forums suggest the problem is an incorrect pathtojsfiles in grid.loader.js

我的前缀我用document.URL这样:

I prefix mine with document.URL like this:

function jqGridInclude()
{
  var pathtojsfiles = document.URL + "script/jqGrid/src/"; // need to be ajusted
  ...
}

如果设置pathtojsfiles到错误的值,你在Firebug中看到'找不到文件'错误。这一切都很好。

If you set pathtojsfiles to the wrong value you see 'file not found' errors in Firebug. It all loads fine.

http://forum.jquery.com/topic/jqgrid-is-not-a-function

这个帖子有一个死胡同:
@milenaa:我认为这首先是一个路径问题,因为我之前已经有了它,但它的工作原理如下:我有一个菜单调用一些服务器端控制器返回一些数据或我发送他们的一些数据。
当我点击调用后来调用jqgrid函数的控制器的链接时,它可以工作。但是,如果我首先调用另一个函数,jqgrid不起作用。页面包括所有的这两种情况都需要js。
它就像其他函数一样不让jqgrid工作......但我不知道为什么......

This thread has a dead end: @milenaa: "I thought that it was a path problem at first, as I already had it before, but it works like this: I have a menu which calls some server-side controllers that returns some data or I send some data for them. When I click on the link that calls the controller that later calls the jqgrid function it works. But, if first I call the other function, jqgrid doesn't work. And the page includes all the js needed for both cases. Its just like the other function doesn't let jqgrid work ... But I don't know why..."

读这个让我觉得我有类似的问题。
我不得不承认我不熟悉Javascript的执行模型。
关于如何解决或调试这个的任何想法?

Reading this makes my think I have a similar problem. I have to admit that I'm not familiar with the execution model of Javascript. Any ideas on how to solve or debug this?

推荐答案

我想你在互联网上有所描述的问题资源管理器。请看以下旧答案。问题是grid.loader.js中当前使用的方法无法保证所包含的文件将以完全相同的顺序执行,并且在<$ c之前全部执行$ c> jQuery(document).ready 处理程序开始执行。所有加载的文件都已经在Web浏览器缓存中(就像你用重新加载页面所描述的那样)然后所有工作都正确,如果没有你的代码使用jqGrid可以执行之前 jqGrid JavaScript是准备好。

I suppose that you has the described problem in the Internet Explorer. Look at the following old answer. The problem is that the method currently used in grid.loader.js have no guarantee, that the included files will be executed in exact the same order in which are included and moreover are all executed before jQuery(document).ready handler start to execute. It all the loaded files are already in the web browser cache (exactly like you describe with "reloading" of page) then all work correct, if not your code used jqGrid can be executed before the jqGrid JavaScript is ready.

我建议你不包括 grid.loader.js。而不是你可以手动包含grid.loader.js所需的所有文件,顺序可以在 grid.loader.js 。您可以尝试使用我在我在trirand论坛中的答案。我对解决方法的唯一限制是:您不能在开头使用具有XML标头的XHTML代码。

I recommend you not include grid.loader.js at all. Instead of that you can include manually all files which you could need from grid.loader.js in the same order which you can see in grid.loader.js. Another way you can try to use the workaround which I described in my answer in trirand forum. The only restriction which I know with the workaround is: you can not use XHTML code which has XML header at the beginning.

这篇关于是什么导致“jqGrid不是一个功能”错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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