Generic javascript view - documentation

I was interested in trying out some generic javascript views, but I do not really know where to begin. Is there some documentation on which functions and classes are available , how they interact with other knime components etc?

All I could find were some examples in the hub from other users, but they must have started from somewhere as well?

Hey @Zvereec1,

Here is a link to the documentation page on available classes and their descriptions. It was made on a older version of KAP, but it should still be applicable/working on newer versions of KAP.

Also see:

You can find more information for specific nodes under “Node Details” → “Options”

Hope this helps,
TL

1 Like

Thank you for your reply, I appreciate it! Yes, I came across that part of the documentation, but I am missing basic stuff like the refresh button.

I saw a snippet from another users where he calls that button using parent.document.getElementsByClassName(“refresh-button button primary compact”), but I would like to know where I can find these class names.

In addition, is it technically possible to create your own buttons from scratch? That do other actions than just refreshing?

1 Like

Yes! It is possible to make a button that does something else in the javascript view.

Here is an example I did where I create a button that will open the link to our current thread:

Node setup for creating the button:

How the view looks:
Screenshot 2024-04-25 at 11.17.49

Result:

Though, keep in mind, if you want to do something like I did, it will not open it up in your web browser, it will be done through KNIME.

TL

2 Likes

For your first point on where he found the class name. I am fairly certain he used the DOM to extract the class name. As from the post I believe you reference, he is manipulating the front end using javascript to change the refresh button so he can use his own custom css styling.

You can extract the css class name through inspecting the webpage it is deployed on such as:

However, this is only possible if you have it deployed as you need to inspect it to get the class. You could try searching through the github, but it will be pretty difficult to single out a particular button’s css styling.

Hope this helps,
TL

2 Likes

That makes sense, I need to brush up on my (limited) front-end knowledge :slight_smile: Thank you!

1 Like