Ui_table column width control

I may be missing the point here, but do you have to define the column names in the ui_control/tabulator object? The number of columns and the column names will change, you say. Couldn't you just let ui_table use the row object properties as column names, and specify that the column width should fit the data? This can be done by setting ui_control to {"tabulator": {"layout": "fitData"}}. Alternative layouts are fitDataFill, fitDataStretch and fitColumns.

[{"id":"57f4f07a766d8864","type":"inject","z":"44b413355573db5e","name":"1620, 1630, 1650, 1702","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"1620\":\"PLC_time:2023-01-19 09:58:16.721\",\"1630\":\"PLC_time:\",\"1650\":\"PLC_time:2023-01-19 09:58:16.721\",\"1702\":\"PLC_time:\"},{\"1620\":\"TPOS: 0\",\"1630\":\"TPOS:\",\"1650\":\"TPOS: 0\",\"1702\":\"TPOS:\"},{\"1620\":\"ASEA: 0\",\"1630\":\"ASEA:\",\"1650\":\"ASEA: 0\",\"1702\":\"ASEA:\"},{\"1620\":\"FILC: 0\",\"1630\":\"FILC:\",\"1650\":\"FILC: 0\",\"1702\":\"FILC:\"}]","payloadType":"json","x":280,"y":340,"wires":[["fbb69812210d45f6"]]},{"id":"d4a90f5ce3ada438","type":"inject","z":"44b413355573db5e","name":"1120, 1130","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"1120\":\"PLC_time:2023-01-19 09:59:35.728\",\"1130\":\"PLC_time:\"},{\"1120\":\"ORDE:\",\"1130\":\"ORDE:\"},{\"1120\":\"FIST: 0\",\"1130\":\"FIST:\"},{\"1120\":\"ASEN: 0\",\"1130\":\"ASEN:\"},{\"1120\":\"RELE: 0\",\"1130\":\"RELE:\"},{\"1120\":\"ASEA: 0\",\"1130\":\"ASEA:\"}]","payloadType":"json","x":240,"y":420,"wires":[["fbb69812210d45f6"]]},{"id":"6a921f511e28a358","type":"ui_table","z":"44b413355573db5e","group":"50e50a879458a7e6","name":"","order":0,"width":"27","height":"14","columns":[],"outputs":0,"cts":false,"x":650,"y":380,"wires":[]},{"id":"fbb69812210d45f6","type":"change","z":"44b413355573db5e","name":"ui_control","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"tabulator\":{\"layout\":\"fitData\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":380,"wires":[["6a921f511e28a358"]]},{"id":"50e50a879458a7e6","type":"ui_group","name":"TableTest","tab":"0d9a8e8bae5c6a8d","order":1,"disp":true,"width":"27","collapse":false,"className":""},{"id":"0d9a8e8bae5c6a8d","type":"ui_tab","name":"TestTab","icon":"dashboard","disabled":false,"hidden":false}]
2 Likes