Hi Community,
I have a problem regarding generic javascript views and the import of a js-file
(I know that this seems to be asked alot - but from the previous answers I do not seem to get it to work )
Maybe someone has an idea what I am doing wrongâŚ
Example workflow of some of my tries:
tabulator example.knwf (264.2 KB)
E.g.:
Hi Alexander,
It seems that including the content of the library in the knime_template.js did not work. Just so you know, I got an error after the login (when the main page was being loaded), which for me indicates that it has to do with the loading of the file (and not my workflow).
require.js:5 Uncaught Error: Mismatched anonymous define() module: function(){return ...
For reference, I am trying to use the Mermaid JS library
Is this something we can check via the support?
->trying the same lib as @KnimeWorker - not sure if he got it to work or not
Hi Everyone,
I want to use a third party library combined with the generic JavaScript view:
However I am not sure how to add them to the node
Normally I would just include it through:
link href=âdist/css/tabulator.min.cssâ rel=âstylesheetâ>
script type=âtext/javascriptâ src=âdist/js/tabulator.min.jsâ>
However KNIME does not seem to access the local files in the script
Is there some function like the âAdditional Librariesâ from the java snippet node?
For the CSS file I thiâŚ
I tried to include the js file through a flow variable, though copy&paste and different getscript ways:
-
-$.getScript(âhttps://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/js/tabulator.min.js â, function()
{
-var js = document.createElement(âscriptâ);
js.type = âtext/javascriptâ;
js.src = âhttps://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/js/tabulator.min.js â;
js.onload = function() {
However every time I try it seems like the script is not executed or not at the right time
When inspecting I always get the following error:
When doing it in a simple html file - it works just fine
tabulator.txt (1.5 KB)
In general the import of js seems overly complicated with the generic javascript view
âŚor I am just too stupid to see what I have to do
Hi @AnotherFraudUser ,
Here is a working example for Tabulator (using the same principle as the workflow that solved my issue).
JS Library.knwf (343.5 KB)
Cheers!
Matheus
3 Likes
Hi @toscanomatheus ,
thank you so much!
Just for my understanding
var Tabulator = module.exports;
was the important part which i missed?
I think so. I am no specialist, but I think that when the content of the library runs (from the content of the flow variable) this module and exports js variables are populated. That was also what I struggled with.
1 Like
Great!
Thanks for the explanation
system
Closed
June 2, 2020, 10:48am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.