When upgrading some JavaScript implemented in Spotfire Text Area may fail to execute and error out with the below stack trace:
Execution of Javascript failed:
Type: TypeError
Message: Cannot read property 'xxx' of undefined
Stacktrace: TypeError: Cannot read property 'xxx' of undefined
The same can also be seen logged in console under Developer Tools (Tools > Development > Developer ) of Spotfire Analyst.
In such cases, users should consider following the guidelines from the below wiki article:
https://community.spotfire.com/articles/spotfire/how-to-include-your-own-instances-of-jquery-and-jqueryui-in-text-areas/
Below are the steps at high level that are to be followed with respect to the wiki article:
- Download the analysis named jqueryui-in-a-custom-javascript-10-0.zip that is available as an attachment in the community article at:https://community.spotfire.com/articles/spotfire/how-to-include-your-own-instances-of-jquery-and-jqueryui-in-text-areas/
- Open analysis jQueryUI-in-a-custom-javascript-10-0.dxp
- Right click > Edit HTML > and copy the script 'jQuery and jQueryUI' into your analysis.
- Now in the Edit HTML dialog of your analysis, add the above script and position it as the first script in the list of Scripts.
- Ensure that you have also added the Script parameter 'styleContainerId' with the value as 'style-container'
- Add the below div tag to the HTML Text Area
<div id="style-container"> <!-- This element serves as a container for style elements added by the jQueryUI script. --> </div>
- And in all your JavaScript code you need to add the below line of code at the beginning.
var $ = window.CustomJQuery;
Ensure that you have added the 'jQuery and jQueryUI' script at the top. And add the "var $ = window.CustomJQuery;" in all the necessary JS Scripts at the top so it refers to the libraries that are imported.
Comments
0 comments
Article is closed for comments.