How to access external jQuery libraries like Select2 in Knime

Hi everyone,
I’ve been started working with knime recently and wanted to create a custom node that has both searchbox as well as dropdown, for now I’d able to create a dropdown but i want to add the search functionality to it. I found a workflow which tries to explain the same but a much more information about how to actually call the external library inside the code will greatly help.

PFA the sample of html code that does both search and dropdown, I wanna know how we can actually call the select2 in generic javascript node in knime.

javascript_node.knwf (83.5 KB)

Best,
Neyavanan V

Hi @neyavanan,

Please excuse the late response. It took me a bit to fine a good solution for you. Take a look at this component, in the generic java script view it loads an external script via hte jquery getScript funciton: Choropleth Map – KNIME Hub


// Load Google JavaScript API via jQuery getScript()
$.getScript('https://www.gstatic.com/charts/loader.js')
	.done(function( script, textStatus ) {
		// Load Google corechart package with drawChart() as callback function
		// google.load('visualization', '1', {packages:['corechart'], callback:drawChart});
    		google.charts.load('46', {packages: ['corechart']});
    		google.charts.setOnLoadCallback(drawChart);
	})
	.fail(function( jqxhr, settings, exception ) {
		// Inform user about failure
		alert("Loading Google API failed.");
		
});

best,
Gabriel

Hey Gabriel,

Thanks for the response can you share the workflow you worked on so that i can related with the workflow I currently have, that would be a great help.

Best,
Neyavanan V

H @neyavanan,

It’s inside this component:

You can drag and drop it into your workflow, and then explore it. The code I posted is in the Generic JavaScript View node at the end of the component.

Hey Gabriel,

Thanks for letting me know.

Best,
Neyavanan V

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