Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Regarding the implementation of function jqGridInclude()
29/01/2009
15:01
Avatar
milestogo80
Member
Members
Forum Posts: 5
Member Since:
26/01/2009
sp_UserOfflineSmall Offline

I am facing a difficult problem with JqGrid . I know it's not a bug as such. But trying to find out if there is any solution. Let me explain the problem.

My JQuery  js files are hosted in a webserver , say, http://abc.com . Now I have an html page hosted in a different web server , say , http://xyz.com . I have set base href to http://abc.com and included the main jqgrid scripts like below

<script src=”/jquery/plugins/jqgrid/js/jquery.jqGrid.js”

        type=”text/javascript”></script>

<script src=”/jquery/plugins/jqgrid/js/jqModal.js”

        type=”text/javascript”></script>

<script src=”/jquery/plugins/jqgrid/js/jqDnR.js”

        type=”text/javascript”></script>

I see with this approach , js script was loaded fine and it tried to execute the function jqGridInclude() .Then, it tried to call some js files from the path /jquery/plugins/jqgrid/js . But in IE it failed to include them whereas in firefox it was able to load those files.Upon closer inspection into the function I found that jqGridInclude() has the following piece of code which is causing the issue in IE. 

if(jQuery.browser.safari || jQuery.browser.msie ) {

        jQuery.ajax({url:filename,dataType:'script', async:false,
         cache: true});
} else {

        IncludeJavaScript(filename);
}

So,in case of IE , it tried to make the ajax call by referring to the
relative path and it failed.But in firefox it executed the function
IncludeJavaScript() which is putting a script tag dynamically with href set to
a relative path which is working since we have base href set to
http://abc.com , the webserver hosting the js files. Code from IncludeJavaScript function is shown below.

    function IncludeJavaScript(jsFile)
    {
        var oHead = document.getElementsByTagName('head')[0];
        var oScript = document.createElement('script');
        oScript.type = 'text/javascript';
        oScript.src = jsFile;
        oHead.appendChild(oScript);
    };

Please let me know

i)if there is any solution for this scenario.

ii)Also,could anybody please tell me why the jqGrid's approach for loading the internal js files differs from one browser to another.just inquisitive.

31/01/2009
05:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

You are absolutley right. During all releases of jqGrid I have try to implement diffrent ways to make this work. None of them was cross browser. If you look into this forum you will see that many users reported problems loading the modules in IE. Until now this is the only solution that work in FF,IE, Opera and Safari.

If you have time to google this problem you will see that currently there is no cross browser solution of dynamic loading the javascript.

At last there are some solutions, but the size of code is too big.

Also, I will be glad to see a really cross browser solution that do not have the current limitations of the jqGrid loader.

Thank you

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

16/02/2009
17:39
Avatar
mjcoder
New Member
Members
Forum Posts: 1
Member Since:
17/02/2009
sp_UserOfflineSmall Offline

Tony, any reason why you exclude Firefox from using the jQuery.ajax loader to bring in the jqGrid includes?:

     32         if(jQuery.browser.safari || jQuery.browser.msie ) {
     33                     jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
     34         } else {
     35             IncludeJavaScript(filename);
     36         }

I was not able to get Firefox to load the grid when IncludeJavaScript() was used.  The reason being is I am using jQuery.ajax to bring in jquery.jqgrid.js. 

IncludeJavaScript() only works with Firefox when I statically include the jquery.jqgrid.js file with script tags.

Firefox seems to use jQuery.ajax() w/o any issue.

17/02/2009
01:21
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Yes the loader makes some problems and my plans are to change this behaviour in next release. The only problem browsers will be Safari and google Chrome, but I hope to find solution for this.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
46 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information