Forum
23:39
28/05/2010
I am getting the jqGrid is not a function error but ONLY in Firefox 4 (both Mac and PC). Not in Firefox 3.6.16, Safari (latest), Chrome (latest), Opera (latest), IE8 or any other browser I tried.
The code worked fine previously and no code changes have been made. Additionally I am loading everything in the correct order. I upgraded to FF4 and immediately started getting this error:
I have:
which is correct and my js loading order looks like this:
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/js/jquery-ui-1.8.1.custom.min.js"></script><script type="text/javascript" src="/js/i18n/grid.locale-en.js"></script><script type="text/javascript" src="/js/jquery.jqGrid.js"></script> <script type="text/javascript" src="/js/ajaxupload.js"></script>jqGrid itself is called by a script included in the page that uses it and I have tried everything from placing that code at the bottom of the file to using a delayed loading method available in the framework I am using (Zend Framework) to force the code that calls jqGrid to load absolutely last. Nothing works.
Remember, this works fine in every browser I could find, even Firefox 3.6.16, it only happens in Firefox 4. Any ideas?
---------------
Solution (thanks to Oleg) is to edit the way the various js files are included in the loader... jquery.jqGrid.js
I changed the various browser specific loading methods to a basic:
document.writeln("<script type='text/javascript' src='"+filename+"'></script>");and that fixed it.
14:51
10/08/2009
Hello miguelito!
The usage of jQuery.ajax with async:false is not the best way. If you not use XHTML having <?xml version="1.0" encoding="utf-8"?> as the first line the solution with document.writeln in the <head> will work better because it loads many javascripts files parallel (see here and here) and then execute it sequentiel in the correct order. So the loading will be quickly.
Additionally starting with jqGrid 4.0 you can use jquery.jqGrid.src.js with the full code of jqGrid in one file. The only problem of the way is that debugger (for example IE developer tools) works slowly with one large file. So I personally prefer to include all the modules with separate <script> statement. The way work perfect in all browsers, debugging is quickly and if I post the bug report I can do it in the original jqGrid modules. Moreover in the case you can place <script> inside of <body> (if you prefer the style) without any disadvantades of the document.writeln method in the case.
Best regards
Oleg
07:24
10/05/2011
I have asimilar problem. I am still very new, please guide me.
When I created a new WebApplication, it works fine. Creating Sqlconnection, and the grid showed up.
And now I want to put it into my friend's existing work, which I believe is a Web Site. I basically just did the method, everything exactly the same. But when I run debug, the page only shows a blank page. The grid doesn't show up at all.
The Firebug shows "1 error" saying the jqgrid is not a function.
I run these both on the same browser, Firefox 4. I don't know what is going on.
Please help me.
12:47
10/08/2009
Hello Freya Crescent,
You should post more information about the code which you use. The most important is not only the JavaScripts which you use, but how and in which order you loads the JavaScript files. You should include all files which you need in the correct order. You should take in consideration, that including of one file twice can follow to the error.
Best regards
Oleg
10:51
10/05/2011
Hello OlegK
Here is my code:
<%@ Register Assembly="Trirand.Web" TagPrefix="trirand" Namespace="Trirand.Web.UI.WebControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT.....t;>
<html xmlns="http://www.w3.org/1999/xhtml&q.....t;>; />
<!-- The jQuery UI theme extension jqGrid needs -->
<link rel="stylesheet" type="text/css" media="screen" href="/themes/ui.jqgrid.css" />
<!-- jQuery runtime minified -->
<script src="http://ajax.microsoft.com/ajax....." type="text/javascript"></script>
<!-- The localization file we need, English in this case -->
<script src="/Js/trirand/i18n/grid.locale-en.js" type="text/javascript"></script>
<!-- The jqGrid client-side javascript -->
<script src="/Js/trirand/jquery.jqGrid.min.js" type="text/javascript"></script>
<!-- This jQuery UI reference is needed only for the demo (code tabs). jqGrid per se does not need it. -->
</head>
<body>
<form id="form1" runat="server">
<div>
<trirand:JQGrid ID="JQGrid1" runat="server">
<Columns>
<trirand:JQGridColumn DataField="ID" PrimaryKey="true">
</trirand:JQGridColumn>
<trirand:JQGridColumn DataField="Name">
</trirand:JQGridColumn>
<trirand:JQGridColumn DataField="Photo">
</trirand:JQGridColumn>
<trirand:JQGridColumn DataField="Rating">
</trirand:JQGridColumn>
</Columns>
<SortSettings InitialSortColumn=""></SortSettings>
</trirand:JQGrid>
</div>
</form>
</body>
</html>
I did the same on a completely blank project and it works fine. Now I want to apply this to an existing work but the grid doesn't show up at all. At first I thought it was my code. So I used back sample code provided at the demo into the existing work and still, it doesn't show up.
13:46
10/08/2009
Hello!
There are different forms for commercial and open sorce free version of jqGrid. Because you use commertial version you should post your question in another forum.
Best regards
Oleg
12:03
07/09/2011
Hi,
I think I got a similar issue with Firefox 6. Here's some details and the fix I applied (similar to the one suggested in this thread, but more specific for FF >4):
- jQgrid version 4.1.2
- Firefox version 6.0.1
- enabled grid.loader.js
Original code:
----------------------------------------------------
for(var i=0;i<modules.length; i++)
{
if(modules[i].include === true) {
filename = pathtojsfiles+modules[i].incfile;
if(jQuery.browser.safari) {
jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
} else {
if (jQuery.browser.msie) {
document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>');
} else {
IncludeJavaScript(filename);
}
}
}
}
----------------------------------------------------
Fixed version:
----------------------------------------------------
for(var i=0;i<modules.length; i++)
{
if(modules[i].include === true) {
filename = pathtojsfiles+modules[i].incfile;
if(jQuery.browser.safari) {
jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
} else {
// if (jQuery.browser.msie) {
if (jQuery.browser.msie || (jQuery.browser.mozilla && parseInt(jQuery.browser.version) >= 2)) {
document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>');
} else {
IncludeJavaScript(filename);
}
}
}
}
----------------------------------------------------
since jquery.browser.version returns
- 2 for firefox 4
- 6 for firefox 6.
- 1.9 for firefox 3 (not affected)
Hope it helps.
Most Users Ever Online: 715
Currently Online:
19 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66