[4.1.1] Run jQuery in a portlet.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[4.1.1] Run jQuery in a portlet.

Nathan Keiter
I am trying to get a very simple page to render. Even though all the resources are loaded, jQuery and jQuery UI are yet undefined.


Has anyone been able to create a portlet in 4.1.x or greater than runs jQuery as a loaded resource?


Is there some kind of non-standard trick to get this to work?


Source:

Screen Shot 2017-12-06 at 10.02.28 AM.png
[cid:a9b2f6a2-1b41-4bf8-b07c-3c12c67408e3]


Error:

[cid:6b0a0b81-77c2-4d50-b4a9-504bf692348e]


Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
https://www.gettysburg.edu

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/1512573613605.28330%40gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2017-12-06 at 10.09.47 AM.png (157K) Download Attachment
Screen Shot 2017-12-06 at 10.02.28 AM.png (155K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [4.1.1] Run jQuery in a portlet.

Jason Tesser-2
I think in this case you would need to load JQuery into the HEAD of the HTML right?

You could try something like 

(function () {
    var ele = document.createElement('script');
    ele.id = "JQuery";
    ele.onload = function () {
        //code to be executed when the document has been loaded
    };
    document.getElementsByTagName('head')[0].appendChild(ele);
})();

THEN add for the other JS imports as well 

On Wed, Dec 6, 2017 at 10:20 AM Nathan Keiter <[hidden email]> wrote:
I am trying to get a very simple page to render. Even though all the resources are loaded, jQuery and jQuery UI are yet undefined.


Has anyone been able to create a portlet in 4.1.x or greater than runs jQuery as a loaded resource?


Is there some kind of non-standard trick to get this to work?


Source:

Screen Shot 2017-12-06 at 10.02.28 AM.png
[cid:a9b2f6a2-1b41-4bf8-b07c-3c12c67408e3]


Error:

[cid:6b0a0b81-77c2-4d50-b4a9-504bf692348e]


Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: <a href="tel:(717)%20337-6993" value="+17173376993" target="_blank">717.337.6993
https://www.gettysburg.edu

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/1512573613605.28330%40gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CALDe1GNYtQVScSKFt15r0P%2BTTojhpCWcEfiKd0ETWo2kWZy-WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: [4.1.1] Run jQuery in a portlet.

Nathan Keiter

Hmm, ok, I’ll try that.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jason Tesser
Sent: Wednesday, December 06, 2017 11:01 AM
To: [hidden email]
Subject: Re: [dotcms] [4.1.1] Run jQuery in a portlet.

 

I think in this case you would need to load JQuery into the HEAD of the HTML right?

 

You could try something like 

 

(function () {

    var ele = document.createElement('script');

    ele.id = "JQuery";

    ele.onload = function () {

        //code to be executed when the document has been loaded

    };

    document.getElementsByTagName('head')[0].appendChild(ele);

})();

 

THEN add for the other JS imports as well 

 

On Wed, Dec 6, 2017 at 10:20 AM Nathan Keiter <[hidden email]> wrote:

I am trying to get a very simple page to render. Even though all the resources are loaded, jQuery and jQuery UI are yet undefined.


Has anyone been able to create a portlet in 4.1.x or greater than runs jQuery as a loaded resource?


Is there some kind of non-standard trick to get this to work?


Source:

Screen Shot 2017-12-06 at 10.02.28 AM.png
[cid:a9b2f6a2-1b41-4bf8-b07c-3c12c67408e3]


Error:

[cid:6b0a0b81-77c2-4d50-b4a9-504bf692348e]


Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box <a href="https://maps.google.com/?q=2453&#43;%7C&#43;300&#43;North&#43;Washington&#43;Street&#43;%7C&#43;Gettysburg,&#43;PA&#43;17325&amp;entry=gmail&amp;source=g"> 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: <a href="tel:(717)%20337-6993" target="_blank">717.337.6993
https://www.gettysburg.edu

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/1512573613605.28330%40gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CALDe1GNYtQVScSKFt15r0P%2BTTojhpCWcEfiKd0ETWo2kWZy-WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/7d6210a9442a4f56aa8811ffb921afff%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.