Ui-table supports ui_control

aha - thanks . I assume I was doing something wrong in not being able to get that id field.
I have just tried id:cell.getRow().getIndex() - and it works if I now include id back into the input payload. !!

Do you know how to turn off the 'noise' that is being pushed out to msg.payload.
I only have a cellEdited callback as I want to be able to update single cells in a column. Not bothered about anything else. so I have no other callbacks specified.

Yet, I am finding that If I simply click on any cell in any row, I get a message pushed out to debug.
I do not have cellClick callback present. The only output that I want to get from the table is the cellEdited - and that piece is working fine.

Hi Dave,

the chellClick callback is part of the "vanilla" function of ui-table. See info panel.

You can disable it by sending a empty string.

{
  "payload":null,
  "ui_control":
    {"tabulator":{"cellClick":""}}
}

or an empty function.
This is due to the mix iterative configuration based on the core functionalities.

A) core configuration done inside the editor ui
B) merge any additional config via ui_control

Hope this helps.

oh jeez. Where is that documented?
I have spent some hours wading through the Tabulator doc and what there is of UI Table but never came across this.

You say look in the info panel - I am but not seeing it ???.

Hi Dave,
I meant vanilla Node-RED dashboard widget ui-table not tabulator directly.

To achieve this function the cellClick callback is used.
I know the latest ui-control feature upgrade is not documented in detail. Most is described by the example flow. Sorry for that it is only lack of time that docs are not always up to date. (BTW who RTFM anyway? - I do but ...)

In addition for anybody interested:

How customizing ui-table with ui_controll messages work is:

  • tabulator is configured by the settings in the editor UI
  • messages with a msg.ui_control object will add or modify features of tabulator. It do not replace the configuration done in the UI
  • subsequent ui_control messages are merged into the tabulator object! So they do not replace the existing config
  • you can modify existing column config of individual columns. The column is matched by the field property.
  • if you do not pass a payload with in your msg to ui-table containing ui_control the payload has to be null (this is necessary to trick the dashboard a little bit to pass ui_control objects unaltered to ui-table to perform the merge and column matching)

This is the default tabulator configuration:

{
  layout: 'fitColumns',
  autoColumns: columndata.length == 0,
  movableColumns: true,
  cellClick: 'function(e, cell) { $scope.send({topic:cell.getField(), payload:cell.getData(), row:(cell.getRow()).getPosition()}); };'
  columns: columndata,
  data: tabledata,
}

Hello Christian,

I would like to ask, how do you do this 2 Colum Group ( Measurment & Settings) with other Columns? Because I try but I get only 1 ( the last in the column list).

here is my code of ui_control:

{
"formatterParams": {
"target": "_blank"
},
"title": "Measurements",
"columns": [
{
"title": "Value",
"field": "sensor_value",
"formatter": "plaintext",
"align": "center"
},
{
"title": "Units",
"field": "units",
"formatter": "plaintext",
"align": "center",
"width": 50
}
]
},
{
"formatterParams": {
"target": "_blank"
},
"title": "Location",
"columns": [
{
"title": "Latitude",
"field": "lat",
"formatter": "plaintext"
},
{
"title": "Longitude",
"field": "long",
"formatter": "plaintext",
"align": "center"
}
]
}

So Is that I can get it, the three structure is not perfect decoded ??

{
   "formatterParams": {
   "target": "_blank"
     },
        "title": "Measurements",
         "columns": [
               {
                  "title": "Value",
                  "field": "sensor_value",
                  "formatter": "plaintext",
                  "align": "center"
               },
               {
                  "title": "Units",
                  "field": "units",
                  "formatter": "plaintext",
                  "align": "center",
                  "width": 50
             }
           ]
        },
        {
           "formatterParams": {
                 "target": "_blank"
            },
            "title": "Location",
            "columns": [
                  {
                      "title": "Latitude",
                       "field": "lat",
                       "formatter": "plaintext"
                  },
                  {
                       "title": "Longitude",
                       "field": "long",
                       "formatter": "plaintext",
                       "align": "center"
                  }
            ]
        }

You only need for URL links to open the link on a new Tab. Can be deleted

Something is missing at the beginning too. Please refer to one of the examples of ui-table for a complete JSON object.
Perhaps paste your JSON into a JSON editor (Any node red node which imput field you can switch to json like the change node / online validators / vs code or similar) and validate it.

here is my complete json;

{
    "tabulator": {
        "columnHeaderVertAlign": "middle",
        "columns": [
            {
                "title": "Timestamp",
                "field": "scantime",
                "formatter": "datetime",
                "formatterParams": {
                    "inputFormat": "YYYY-MM-DD HH:mm:ss)",
                    "invalidPlaceholder": "(invalid date)"
                },
                "minwidth": 150,
                "align": "center"
            },
            {
                "title": "UID / ID",
                "field": "ID",
                "formatter": "plaintext",
                "headerFilter": "id",
                "minwidth": 100,
                "align": "center"
            },
            {
                "title": "Type",
                "field": "type",
                "formatter": "plaintext",
                "align": "center"
            },
            {
                "title": "Measurements",
                "columns": [
                    {
                        "title": "Value",
                        "field": "sensor_value",
                        "formatter": "progress",
                        "formatterParams": {
                            "min": -50,
                            "max": 50,
                            "color": [
                                "blue",
                                "green",
                                "red"
                            ],
                            "legend": "function (value) {return '  '+value;}",
                            "legendColor": "#101010",
                            "legendAlign": "left"
                        }
                    },
                    {
                        "title": "Units",
                        "field": "units",
                        "formatter": "plaintext",
                        "align": "center",
                        "width": 50
                    }
                ]
            },
            {
                "title": "Location",
                "columns": [
                    {
                        "title": "Latitude",
                        "field": "lat",
                        "formatter": "plaintext",
                        "width": 60
                    },
                    {
                        "title": "Longitude",
                        "field": "long",
                        "formatter": "plaintext",
                        "align": "center",
                        "width": 60
                    }
                ]
            },
            {
                "title": "NDEF content",
                "field": "content",
                "formatter": "plaintext",
                "align": "center"
            }
        ],
        "layout": "fitColumns",
        "movableRows": false,
        "groupBy": ""
    },
    "customHeight": 12
}

Looks good ... and on the console?
And a screenshot would be helpfully (simply copy paste here)

I have some Table Header:

But I would like with some like Measurement Group for location
Location
Latitude | Longitude

Strange ... I see your problem now but can't find a solution without testing it on node-red.

Hope I find time this evening.

Ok thanks. I wait you feedback :slight_smile:

My console output:

  1. columnHeaderVertAlign perhaps a problem in the docs ... ?
  2. minWidth! Tabulator uses camelCase (seems there ist a bug in the config-ui defined tables too.
  3. ditto.
  4. check how to use filters. Not with filed names!

But to your initial problem: still strange... sorry I have to dig deeper and currently no time.

Ok Thanks so much. I try to solve with this warning.

Hi.
There is a bug in the merging process of ui_control messages on column groups. Hopefully I can fix that over the weekend.
Sorry.

Ok thanks you!!

Hello Christian-Me ,

sorry I have some another questions about table. I would like use these 'Theme' of Tabulator ( http://tabulator.info/docs/4.7/theme) to change the format and visualization of my table. Its will be possible to do with ui_control message or another method ? because I try to do with the template_ui but I don't see any change in my table.

Thanks very much.

Found and fixed the problem. Will be available soon:

To the css loading. It should be possible as others solved some issues by editing the css. But sorry, I don't know how - not the css / template guy. perhaps do a search on "ui-table css" to get any hints. There are only two css directly available "tabulator.css" and "midnight.css" depending on your ui scheme.

Chris

Hi,
I'm trying to retrieve the data from a table, but i'm not sure how to do this. I would use the getData() function from tabulator + this.send command I guess, but i'm lost on how to make it work. Anyone to put me in the right direction?