UI_table: remove headers and filter rows

The UI_table node is doing me a great service!
I use it to display data from a 5 column csv file (c1, c2, text, photo, pj) of which I only display the last 3. But since I'm a newbe, I can't seem to remove the header row (I've already removed the column titles because the cell content is self-explanatory that I can do without it, but the lines and arrows remain visible).
I was also wondering if this node can filter data.
In fact, I would like to display only rows whose 1st column value is> = X and second column value is <= X. I tried with the function node but not having any programming skills, I did not succeed.
I searched everywhere on the forum and on google but I can't find it and I'm going in circles.
Could anyone please advise me?
Laurent

[{"id":"f94e2f2.4492cd","type":"inject","z":"d217e624.c76d68","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":560,"wires":[["9babb54f.052fc8"]]},{"id":"9babb54f.052fc8","type":"file in","z":"d217e624.c76d68","name":"Read database test","filename":"/home/pi/.local/share/test.csv","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":150,"y":660,"wires":[["8e040841.729cc8","e4bfa8de.3c58a8"]]},{"id":"8e040841.729cc8","type":"csv","z":"d217e624.c76d68","name":"CSV","sep":",","hdrin":true,"hdrout":"","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":false,"x":110,"y":700,"wires":[["bfffece9.7d382","baf69f4f.fbfc8"]]},{"id":"e4bfa8de.3c58a8","type":"debug","z":"d217e624.c76d68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":430,"y":660,"wires":[]},{"id":"bfffece9.7d382","type":"debug","z":"d217e624.c76d68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":430,"y":740,"wires":[]},{"id":"baf69f4f.fbfc8","type":"ui_table","z":"d217e624.c76d68","group":"835074f4.0b4148","name":"table \"test\"","order":3,"width":"0","height":"0","columns":[{"field":"photo","title":"","width":"15%","align":"center","formatter":"image","formatterParams":{"target":"_blank"}},{"field":"txt","title":"","width":"80%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"pj","title":"","width":"5%","align":"center","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":650,"y":700,"wires":[]},{"id":"835074f4.0b4148","type":"ui_group","z":"","name":"test","tab":"d52da53e.8c3c58","order":1,"disp":true,"width":"6","collapse":false},{"id":"d52da53e.8c3c58","type":"ui_tab","z":"","name":"Tab test","icon":"dashboard","order":16,"disabled":false,"hidden":false}]

To remove the header, send property msg.ui_control with

{"tabulator":{"headerVisible":false}}

to your ui_table node.

Filter: Maybe this page can help you source

Thank you for your reply.
I integrated your code in a Change node with the msg.ui_control
and it works perfectly, thank you very much.
However, I am unable to implement the filter in this way with the code provided on the Tabulator site. If you have an idea...

Laurent

Hi Laurant.

Filter: What is your input and what filter criteria schould be applied?

Henning

Hello Henning,
I'am at work until 18h. Could I answer you after ?
Laurent

Hahah. We don't have here service level agreements about response time ;-).
Don't worry. Best would be to get a simple table in JSON and criteria.

Best regards, Henning

1 Like

Hi ... I had a quick look but without demo data it is quite difficult:

var doy = flow.get("doy")

msg.ui_control = {tabulator:{}};

table.setFilter([
    {field:"date_debut", type:">=", value:doy},
    {field:"date_fin", type:"<=", value:doy },
]);

msg.ui_control.tabulator[msg.topic]=msg.payload;
return msg;

There is a lot of things going wrong ...

ui_control sets and updates the layout / appearance and some callback functions. So everything you can setup when the table is created. (Basically everything described under Layout in the docs)

What you try to do is sending a command (aka calling a function) to an existing table. And yes, that's possible:

This form the tabulator docs:


assumes that you have access to the table object (from within the browser). But your script is running on node red perhaps on the other side of the world :wink:

So you have to send your command to the ui-table node which send it to the dashboard on another browser (or tab) and do the job for you.

So this could work or give you a kickstart:

msg.payload={
    command: "setFilter",
    arguments: 
        [
            [
                {field:"date_debut", type:">=", value:doy},
                {field:"date_fin", type:"<=", value:doy }
            ]
        ],
    returnPromise: false
}
return msg;

Note that the arguments property is an array as command can have multiple arguments. The first argument of setFilter expects an array of objects. So another array.

Send this msg to ui-table and you should get your filters set (open the development tools in your browser to see if you get any console error messages) They appear in the browser where the dashboard is running and not in the editors debug tab!

Good evening Chris and many thanks for your long and detailed response. I immediately launch into the discovery of the elements that you sent me and will keep you informed tomorrow of my progress.
Thank you again for your help,
Laurent

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