Jasper Server 8.0.0 Custom Input Controls not Working - jQuery not loading

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

Jasper Server 8.0.0 does not seem to load jQuery at all.  This results in my custom tabs and input controls not showing on the input dialogue.

When in F12 Console, I type in at the prompt:  if (jQuery && typeof jQuery !== "undefined") { console.log(jQuery.fn.jquery); }

the result is:

VM868:1 Uncaught ReferenceError: jQuery is not defined
    at eval (eval at <anonymous> (flow.html:1), <anonymous>:1:1)
    at <anonymous>:1:1

I have tested this on various pages, e.g. when the input dialogue is displayed, the schedule, etc.  jQuery just does not load.

How do I get around this issue?  I have a very strict timeline in which to get those custom tabs and input controls to work. 

I am using the Community Edition.

The custom .jsp files were used were placed in this location \apache-tomcat-10.0.14\webapps\jasperserver\WEB-INF\jsp\modules\inputControls.

nafiesa.allie's picture
Joined: Oct 8 2018 - 6:55am
Last seen: 1 month 2 days ago

I also need this. Switching to "vanilla.js" is not a workable option for me; my custom pages use libraries that depend on jQuery.

ken.freeman - 3 months 1 week ago

2 Answers:

If you need jQuery just include it in your JSP with a script tag like

<script src="${pageContext.request.contextPath}/scripts/jquery.js"></script>

If you need it for multiple pages you can include it in decoratorMinimalImports.jsp

You also need to place your own copy of jquery.js into your scripts folder.

yplakosh's picture
129
Joined: Jun 23 2009 - 9:54am
Last seen: 2 weeks 3 days ago

No references to 3rd party libraries in the global scope

Starting JRS 8.0.0 the libraries used by JRS will not be exposed to the global scope. Because of that, an attempt to use jQuery from the global scope will not work unless jQuery is added to the global scope by your custom code.

Use DOM API instead

In JSP where your JavaScript code is, replace:

jQuery(document).on("controls:initialized", function(event, controlsViewModel) {

with

document.addEventListener("controls:initialized", function(event, others) {    
    var controlsViewModel = event.detail;
yplakosh's picture
129
Joined: Jun 23 2009 - 9:54am
Last seen: 2 weeks 3 days ago
Feedback