npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@omrid01/node-red-dashboard-2-table-tabulator

v0.5.1

Published

Table node, using Tabulator-tables package, for Node-RED Dashboard 2.0

Downloads

342

Readme

Table node (using Tabulator) for Node-RED Dashboard 2.0

A short summary of the node's design concepts, functionality & configuration options. Complete, detailed usage reference is provided in the node's on-line help, available in the Node-RED editor.

ui-tabulator

example-pic

The ui-tabulator custom node uses the popular Tabulator JavaScript package, for updating, presenting & querying UI tables.

Note: the node comes in addition to, not replacing, dashboard V2.0's native vue-based table node.

General Overview

  • The node serves as a smart wrapper containing a Tabulator (table) object. For the most part, it calls the Tabulator API as-is (as defined in the Tabulator Documentation).
  • The node enables automatic instantiation of the table (with user-defined configuration & initial data), as well as to dynamically create/modify/destroy tables in runtime.
  • Interface to the node is through messages (regular Node-red msg objects). The msg specifies a command (and arguments), and returns the table's response
  • The table accepts data-setting commands (e.g. setData, addData, updateData, deleteData etc.) as well as data-query commands (getData, searchData etc.), as well as in-cell data edit (from the UI).
  • In addition, the table can send unsolicited event messages for selected table events (cell & row click/double-click, cell edit etc.)
  • By default, the table operates in shared mode, i.e. a common table image (data + styling) in all concurrent dashboard clients. The table image is also cached in the Node-RED datastore, and reloaded upon browser open, refresh etc.
    The node also supports a Multi-User mode, which maintains independent, client-specific table data with "private" messaging.

Message Examples

  • Data-setting command example
msg.tbCmd  = "addData";
msg.tbArgs = [
   [
      {id:1, name:"bob", gender:"male"},
      {id:2, name:"Jenny", gender:"female"}
   ],
   true
];
  • Data-retrieval command example
msg.tbCmd  = "searchData";
msg.tbArgs = [ "age", ">", 12 ];
  • Event example
{
    topic: "tbNotification",
    event: "cellEdited",
    payload: {
        id: 2,
        field: "name",
        newValue: "Jack Brown",
        oldValue: "John Doe"
    },
    _client: {
        socketId: "uXRxjY9yO-Hya1vtAAAB"
    },
    _msgid:"6d9d7a97666f2783"
}

Node Configuration

The node configuration properties (in the editor):

  • Name, Group, Size: - same as in all dashboard 2.0 nodes
  • Initial Table Configuration: JSON object with all table & column definitions, and (optional) initial data
  • Max Width: sets the visible width of the table
  • Notifications: selection of table events which trigger notification messages
  • Multi-user mode: (Y/N)
  • Row-Id validation/duplication check (Y/N)
  • CSS theme: selection of an optional tabulator CSS Stylesheet (e.g. Midnight, Modern etc.)
  • DIV Override: optional: enables to specify a specific HTML DIV Id in which the table will be created, overriding the default DIV, auto-allocated by the Vue framework

Architectural Concepts in Multi-Client Environment

Tables are created as widgets on the client (browser) page. Hence, in case of multiple dashboard clients, a single ui-tabulator node is associated to multiple table widgets. Per Node-RED's framework, every message sent to a ui-tabulator node in a flow, is replicated to all of its widgets. If the table object responds, the flow will receive multiple, identical responses (one per client). To enable a Shared mode, where all table widgets are synchronized and have a common data image, we do the following:

  • Data-setting & styling commands sent from the ui-tabulator node in flow to all table widgets in parallel, thus applying the same changes on the widgets
  • The (identical) table responses to command messages are grouped by msgid, and only a single response is returned to the flow
  • When a user changes table data directly on the UI of any client, an update notification is automatically sent to all other clients
  • The current table data image is always saved in the Node-RED datastore, automatically restoring the table image upon client open/refresh.

Having said the above, some table presentation aspects (on top of the common data image) are user-related by nature, and are not synchronized. For example, users may want to set their own filtering/sorting, or select specific rows for further actions. In such cases, each client table may return a different response to data query commands. For this, the command should be scoped to a specific table widget (by specifying the client Id, or initiating the command from a dashboard objet, e.g. button, on the same client)

Known Issues

Upon server restart, deploy and reconnect, sometimes the client's socket listeners in the Node-RED framework are not restored properly. As a temporary workaround, until this is fixed in Node-RED, each client page automatically reloads itself once upon reconnection (showing a little "flicker").

Node Dependencies

  • Node-JS version >= 18
  • Node-red version >= 3.10
  • Node-red dashboard 2.0, version >= 1.17.1
  • Tabulator version >= 6.2 (comes bundled in the node installation)