Tree list (with selectable nodes) from table data in Javascript View

Hi all,

I’m trying to generate a tree list view from file paths in a table to allow selection of several files and/or folders.

I thought of something along these lines:

  • D3:
  • jQuery:

Ideally, I’d like to retrieve the selected rows/entries as a KNIME table afterwards, similar to the Table View node:

path selected
/path/to/a false
/path/to/a/subfolder false
/path/to/another true
/path/to/another/subfolder true
/path/to/b false

Is there by chance an example workflow somewhere showing how to do this? I’m currently trying to understand how to get the data from a column (or several columns defining the hierarchy) of the input table into an appropriate data structure for one of these javascript plugins.
Or is there maybe a KNIME node implementation doing this already?

Hello @imagejan,

Thanks for your post. Currently, there are no nodes which accomplish what you are trying to do out of the box. I have three suggestions for you:

  1. Use the Table View node to provide the user with the paths they can select in a table format. They can then select the paths using the checkboxes in the table and select Close & Apply and the output table will look almost identical to the one you showed in your post.

  2. You can use a combination of the Generic JavaScript View node and another JavaScript visualization node in a Component. The Generic JS view doesn’t have a data outport, so this option requires the presence of another JS view node to create the output selected data table, but you have the freedom to implement the File tree visualization however you want. You can add the logic to the Generic JavaScript View to publish “selection events” to the other node in the Component view and it will output the table just like you describe. There is a post detailing event publishing here.

  3. Lastly, you could implement a custom node for the file tree viewer. We have some good documentation on development here if you are interested. This option (while obviously the most work) results in both the visualization you are looking for and the output table without the use of additional nodes.

Sorry there isn’t an easier solution, but that is an interesting node idea and I think it would be a really cool to addition to the platform :slight_smile:



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