Nice !
Exactly. There is the need to add a callback to build the array, most likley using the getdata
command as you mentioned. I will have a look when I am back home at night (at work now).
PS: I did a search in the forum to recall how to create a callback function for the ui_table and found a ready to use example..
Copy/paste that callback to the testing flow. Seems to work well.
[{"id":"f0ac6e667fc173d9","type":"tab","label":"Download","disabled":false,"info":"","env":[]},{"id":"44599119a368ca93","type":"ui_table","z":"f0ac6e667fc173d9","group":"870a91418c5861d1","name":"File download","order":1,"width":10,"height":7,"columns":[],"outputs":1,"cts":true,"x":780,"y":160,"wires":[["d592b6fcd9261596"]]},{"id":"658e66209e05b0f5","type":"change","z":"f0ac6e667fc173d9","name":"","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":12,\"tabulator\":{\"columns\":[{\"title\":\" <div style='text-align:center'>#</div>\",\"field\":\"id\",\"width\":15,\"formatter\":\"rowSelection\",\"align\":\"center\"},{\"title\":\" <div style='text-align:center'>File Size</div>\",\"field\":\"filesize\",\"align\":\"center\",\"formatter\":\"text\",\"width\":100,\"layout\":\"fitData\"},{\"title\":\" <div style='text-align:center'>File Name</div>\",\"field\":\"filename\",\"formatter\":\"text\",\"width\":330,\"sorter\":\"alphanum\",\"sorterParams\":{\"alignEmptyValues\":\"bottom\"},\"layout\":\"fitData\",\"align\":\"center\"},{\"title\":\"Check\",\"field\":\"check_box\",\"width\":5,\"formatter\":\"tickCross\",\"formatterParams\":{\"target\":\"_blank\",\"allowEmpty\":true,\"allowTruthy\":true,\"tickElement\":\"<i class='fa fa-check-square-o fa-1x'></i>\",\"crossElement\":\"<i class='fa fa-square-o fa-1x'></i>\"},\"align\":\"center\"}],\"initialSort\":[{\"column\":\"filename\",\"dir\":\"asc\"}],\"setSort\":[{\"column\":\"filename\",\"dir\":\"asc\"}],\"layout\":\"fitColumns\",\"movableColumns\":false,\"resizableColumns\":false,\"headerVisible\":true,\"headerSort\":false,\"autoColumns\":false,\"selectable\":true}}","tot":"json"},{"t":"set","p":"ui_control.tabulator.rowSelectionChanged","pt":"msg","to":"function(data, rows){this.send({ui_control:{'callback':'rowSelectionChanged','rowSelection':data}});}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":160,"wires":[["44599119a368ca93"]]},{"id":"b1c72c679e24cf25","type":"function","z":"f0ac6e667fc173d9","name":"selectRow","func":"\nmsg.payload={\n command:\"selectRow\",\n returnPromise: true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":220,"wires":[["658e66209e05b0f5"]],"info":"# deleteRow(row / [rows])\n\n`row=singleId`\n\nor\n\n`row=[array of IDs]` // seems there is a bug/issue in tabulator\n\ndelete a single the row with an id in the middle from 1 to lastId, hope it exists.\n\nWill fail on the second hit if you inject this two times because the id wad deleteted on the first"},{"id":"d592b6fcd9261596","type":"debug","z":"f0ac6e667fc173d9","name":"Table Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":160,"wires":[]},{"id":"e126649fe405fa5a","type":"ui_button","z":"f0ac6e667fc173d9","name":"","group":"2768d5bb10e62e93","order":0,"width":"4","height":"1","passthru":false,"label":"Select All","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":180,"y":220,"wires":[["b1c72c679e24cf25"]]},{"id":"1cbd77873713897d","type":"ui_button","z":"f0ac6e667fc173d9","name":"","group":"2768d5bb10e62e93","order":2,"width":"4","height":"1","passthru":false,"label":"Initialize Table","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"[{\"id\":10,\"filesize\":100,\"filename\":\"file10\",\"check_box\":true},{\"id\":20,\"filesize\":200,\"filename\":\"file20\",\"check_box\":false}]","payloadType":"json","topic":"topic","topicType":"msg","x":160,"y":160,"wires":[["658e66209e05b0f5"]]},{"id":"960b6ba012d7ced2","type":"ui_spacer","z":"f0ac6e667fc173d9","name":"spacer","group":"2768d5bb10e62e93","order":1,"width":6,"height":1},{"id":"0a70b37758bc78b8","type":"ui_spacer","z":"f0ac6e667fc173d9","name":"spacer","group":"2768d5bb10e62e93","order":2,"width":6,"height":1},{"id":"870a91418c5861d1","type":"ui_group","name":"List of files in directory","tab":"94ff3c5caa315fa9","order":2,"disp":true,"width":"10","collapse":false,"className":""},{"id":"2768d5bb10e62e93","type":"ui_group","name":"Group 1","tab":"94ff3c5caa315fa9","order":1,"disp":false,"width":6,"collapse":false,"className":""},{"id":"94ff3c5caa315fa9","type":"ui_tab","name":"Download","icon":"fa-cloud-download fa-2x","order":4,"disabled":false,"hidden":false}]