JasperSoft ReportServer - Visualize.js integration issues - jasperserver

I am testing out the visualize.js integration from jasper reportserver pro edition. It does not work because my application also has its jquery/require modules and visualize.js also tries to load it's own version of jquery/require modules. The overwriting of my frameworks libraries creates many uncertain and unpredictable issues.
Is there a way to tell jaspersoft to not load jquery/require libraries?
Thanks!

You can make use of the jQuery.noConflict() to handle multiple versions of it on the same page. See here

Maybe it is too late now, but in the past we faced with the similar issues, and the solution was to insert this before your script:
<script type="text/javascript">
var j$ = jQuery.noConflict();
</script>
And afterwards in your script, change all $ to the j$
That is what solved our problem with multiple jQuery libraries on the same page. Hope it helps you too.

Related

Content Delivery Network for html2canvas?

I'm trying to use html2canvas & jsPDF without installing Node.js
(this also because I will add the html pages to a Wordpress site, and want to avoid issues).
While jsPDF offers several "script src url" options,
I see that html2canvas used cdnjs.cloudflare as url only till its version 0.5.0-beta4
(https://cdnjs.com/libraries/html2canvas/0.5.0-beta4).
Looking at latest versions (1.0.0) the Author offers only npm, Yam or local download.
After some research I found that the script is hosted in jsdelivr, open source cdn
(https://www.jsdelivr.com/).
Selecting among several options there is "https://www.jsdelivr.com/package/npm/html2canvas"
where f.e. (among options) you can include:
<script src:"https://cdn.jsdelivr.net/npm/html2canvas#1.0.0-alpha.12/dist/npm/index.js"></script>
or for multiple you can apply the suggested code:
[![](https://data.jsdelivr.com/v1/package/npm/html2canvas/badge)](https://www.jsdelivr.com/package/npm/html2canvas)
I'm rying to use this system, but not sure if I am really including the whole package or not
(there are many issues:
since html2canvas combined with jsPDF is a scipt "in progress", I don't understand when the
issues depend on some my mistake or on real issues).
Can s/one help me comforting the jsdelivr/npm solution? Do I include all with "index.js"?
Thank you in advance.

updated sharethis plugin is not working on ajax

Recently sharethis plugin is updated. i have successfully installed and it was working fine. but i am unable to load the buttons on ajax calls.
I have added this script
<script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=propertystring&product=inline-share-buttons"></script>
Old code using the following
stButtons.locateElements();
is not working any more.
Please note i am using custom share button.
I actually found the solution for this, at least it worked for me. Run this after the template has loaded:
__sharethis__.initialize()

GWT 2.7: Warn users they are using an unsupported browser

I recently upgraded my application to GWT 2.7 from GWT 2.5. This has caused me to drop support for IE6 and IE7.
I would like to provide users with IE6 or IE7 with a warning that their browser is outdated and will not work. At the moment if you go to the app with one of those browsers, you get a blank screen.
I know there are a couple ways that I could hack something together but I would rather use the GWT way, rather than some hack. Is there a GWT hook for unsupported browsers?
Option (hack) One
Drop this into my main.html:
if(document.documentMode === 6 || document.documentMode === 7){
myUnsupportedBrowserWarningFunction();
}
Potential problem with this is that if someone is using a browser that GWT doesn't recognise and I don't recognise (mobile opera? Some other browser), they will still get a blank page.
Option (hack) Two
GWT looks for the compiled JS here:
gwt/myApp/ASDFKLSDJFLSFDJSLDFJLSJDFSDES.cache.js
When someone is using an unsupported browser the following is requested (and is not found):
gwt/myApp/undefined.cache.js
It would be possible to create undefined.cache.js and put your unsupported browser code there. This is obviously a brittle solution and will break with future GWT updates.
Option Three
A recent patch (available in GWT 2.7) allows you to provide a default
permutation (e.g. safari) if GWT can not detect the browser and with
deferred binding you can display a warning that the provided app might not
work correctly as the browser is generally unsupported by GWT.
-- J.
Source
I don't want to set a default permutation for unsupported browsers. I want the site to not work and to display a warning. So this solution doesn't really provide what I am looking for.
Similar Questions & Posts
The same question was asked for an eariler version of GWT in 2009. I hope that GWT has added some kind of hook or best practice in the last 6 years.
More info on setting a default (fallback) permutation
You should be able to use onLoadErrorFn for that: https://code.google.com/p/google-web-toolkit/issues/detail?id=8135
<script>
function gwtLoadError(errMsg) {
// GWT app couldn't load, reason in errorMsg
}
</script>
<meta name="gwt:onLoadErrorFn" content="gwtLoadError">
or possibly onPropertyErrorFn:
<script>
function gwtPropError(propName, allowedValues, actualValue) {
if (propName == 'user.agent') {
// unsupported browser
}
}
</script>
<meta name="gwt:onPropertyErrorFn" content="gwtPropError">
(I don't think user.agent.runtimeWarning would help in this case, but maybe have a look)
There is an easy way:
Conditional Comments
<!--[if lt IE 8]>
<p>You are using an unsupportet browser. Please perform an update</p>
<![endif]-->
I think Option 3 may be the best one, but there is a problem: This will start the actual application (which still may be incompatible).
If this is an issue and you want a clear warning, you can rewrite the permutation selection script (You would need to update the script with the upcoming GWT releases)
You will need to copy this source:
https://gwt.googlesource.com/gwt/+/2.7.0/user/src/com/google/gwt/useragent/rebind/UserAgentPropertyGenerator.java
You could add something like:
$wnd.Location.replace('nosupported.html');
between line 90 and 91

WinJS.UI Metro Animation Library

I'm starting to port over my web app that I've built with Sencha Touch into the Windows 8 world. I'm seeing a lot of WinJS.UI documentation, basically telling me that there are more 'native' feeling animations and UI actions already build into this framework.
My app is already structured, but I'd like to mix in WinJS.UI if I can. How do I go about doing this? I haven't found a link to download the library or anything of the sort.
For example, this link:
http://blogs.msdn.com/b/windowsappdev/archive/2012/05/01/fast-and-fluid-animations-in-your-metro-style-app.aspx
I see that they are using:
<script>
function runAnimation(){
enterPage = WinJS.UI.Animation.enterPage(input);
}
</script>
But I find no documentation on where to include the library.
Little bit lost, any help is appreciated!
These animations are included in the UI.Js from the WinJS Package -- this is the same WinJS that is included in the default Visual Studio Templates. Just create a new HTML Windows Store application, and the details will be there.
Here's your library: http://code.msdn.microsoft.com/windowsapps/Using-the-Animation-787f3720
You can deploy this on your computer and play with the animations.

How do I communicate between two modules in GWT

Hi I am currently facing communicating with two GWT modules.
1. enquiry.html
2. info.html
In enquiry.html i have search results on click of a hyperlink I need to open the info module. Its working fine in my development environment, but when I deploy in linux its causing issue.
Basically when the info.html is loading up, its not able to identify the info.nocache.js
Any help will be highly appreciated.
You can put parameters on the URL, like info.html?resultId=432001
Then, in your code, you can access resultId with
String resultId = com.google.gwt.user.client.Window.Location.getParameter("resultId");