I have problems after upgrading:
- jqGrid from 3.5.3 to 3.8.2
- jquery from 1.3.2 to 1.4.4
- jquery-ui from 1.7.2 to 1.8.8
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 shows me the “jqGrid is not a function ” error.
Searching in the forums suggest the problem is an incorrect pathtojsfiles in grid.loader.js
I prefix mine with document.URL like this:
function jqGridInclude()
{
var pathtojsfiles = document.URL + "script/jqGrid/src/"; // need to be ajusted
...
}
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
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…”
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?
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).readyhandler 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.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.