Hub
Pricing About
WorkflowWorkflow

Generic JavaScript View Custom Selection Example

JavascriptSelectionInteractive eventsGeneric javascript viewKnimeService
paolotamag profile image
VersionlatestLatest, created on 
Oct 24, 2023 2:54 PM
Drag & drop
Like
Download workflow
Workflow preview
This example by @DanielBog (hub.knime.com/DanielBog) shows how to use the 'knimeService' library to create a custom view where the selection event is propagated to a standard view node of KNIME. Interactive Generic JavaScript Views — Functionality (dataversity.net/from-a-for-analytics-to-z-for-zika-virus/) Here, we briefly describe the functionality that helped us to create our interactive generic JavaScript views where the user was able to filter and select the data (for details, please have a look into the full source code in the example workflow). Note that you can use this information and apply it to many different scenarios — to retrieve, select, and filter data. 1. Do you have data available at the input port? How can the data be accessed and retrieved? knimeDataTable.getColumnNames() — accesses the data and retrieves the column names in a string array, with knimeDataTable being a global JavaScript object that is created and populated automatically knimeDataTable.getColumn(columnID) — accesses and retrieves an array of all values contained in the column with the given ID (see node description for the details and methods) 2. How can you select and filter data? knimeService is a second global object that enables you to do this, i.e., support selection and filtering in your view 3. To register a subscriber to the selection events, call the following method: knimeService.subscribeToSelection(tableId, callback) 4. You can also subscribe to a filter event through: knimeService.subscribeToFilter(tableId, callback) 5. A callback is the function to be called when a selection or filter event occurs: filterChanged = function(data) { […] } where “data” is an object that contains information about the currently applied filter 6. To unsubscribe from a filter or selection, call: knimeService.unsubscribeFilter/Selection(tableId, callback). 7. To change the selection, use any of these three convenient methods: knimeService.addRowsToSelection(tableId, rows, callback) knimeService.removeRowsFromSelection(tableId, rows, callback) knimeService.setSelectedRows(tableId, selectedRows, callback)

External resources

  • Publish knimeService selection change event - KNIME Forum
  • How to Publish/Subscribe Events using Custom Javascript Views - KNIME Forum
  • From A for Analytics to Z for Zika Virus - Dataversity
Loading deploymentsLoading ad hoc jobs

Used extensions & nodes

Created with KNIME Analytics Platform version 4.7.2
  • Go to item
    KNIME Base nodesTrusted extension

    KNIME AG, Zurich, Switzerland

    Version 4.7.2

    knime
  • Go to item
    KNIME JavaScript ViewsTrusted extension

    KNIME AG, Zurich, Switzerland

    Version 4.7.0

    knime

Legal

By using or downloading the workflow, you agree to our terms and conditions.

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • Courses + Certification
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more about KNIME Business Hub
© 2025 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Data Processing Agreement
  • Credits