Publish knimeService selection change event

Hi,

I would like to fire an selection change event in the Generic JavaScript View by code and not by the user.

As from this topic https://forum.knime.com/t/how-to-publish-subscribe-events-using-custom-javascript-views/18705 i would like to use the knimeServices like knimeService.setSelectedRows?

This service doesn’t fire any event in my code.

Is there a better way to do this?

Thx

Hey,

this is the correct way to fire the selection event. You might be using not the correct parameter.
With what parameter do you call the function? It has to be setSelectedRows({TableId}, {Array of row keys}, {optional callback}). You can find an example in the attached workflow.
I hope this helps.

GenericJSSelectionExample.knar.knwf (12.5 KB)

Greetings,
Daniel

1 Like

Hey Daniel,

yes it works. But only if the callback function is in another JS Node.
Is it possible to trigger the callback function if the setSelectedRows call is in the same JS Node?

Greetings

Hey,
I don’t think that the same node will receive its selection event, as this node triggered the selection so you should be able to trigger any other function after the setSelectedRows call?
What exactly is your use case?

Greetings,
Daniel

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.