If you are using node-red-node-ui-table
this example shows how to use commands.
[{"id":"36be75f0.115c6a","type":"ui_button","z":"51e5d3061e86059f","name":"","group":"c91332c0.50c11","order":1,"width":0,"height":0,"passthru":false,"label":"Init 20 rows","tooltip":"init table by passing the hole table array (default way)","color":"","bgcolor":"","className":"","icon":"","payload":"20","payloadType":"num","topic":"","topicType":"str","x":264,"y":894,"wires":[["d4dce9b4.1f2588"]]},{"id":"d4dce9b4.1f2588","type":"function","z":"51e5d3061e86059f","name":"table with n rows as array","func":"var numberOfRows = msg.payload;\nflow.set(\"lastId\",numberOfRows);\nmsg.payload=[];\nfor (let i=1; i<=numberOfRows; i++) {\n msg.payload.push({\"id\":i,\"timestamp\":Date.now(),\"text\":\"this is line\"+i})\n}\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":894,"wires":[["f9bfd98.abe1a28","69241bdcfcf2980c"]]},{"id":"12606591.7a3dca","type":"inject","z":"51e5d3061e86059f","name":"Init 20 rows","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":264,"y":928,"wires":[["d4dce9b4.1f2588"]]},{"id":"f9bfd98.abe1a28","type":"debug","z":"51e5d3061e86059f","name":"addRow","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":580,"y":840,"wires":[]},{"id":"69241bdcfcf2980c","type":"ui_table","z":"51e5d3061e86059f","group":"c91332c0.50c11","name":"","order":2,"width":0,"height":0,"columns":[],"outputs":0,"cts":false,"x":570,"y":1000,"wires":[]},{"id":"eb577b4b.510388","type":"function","z":"51e5d3061e86059f","name":"addRow @ top","func":"msg.payload={\n command:msg.topic,\n arguments: [\n msg.payload\n ]\n}\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":495,"y":1064,"wires":[["b54f6ce8.3b1a4","69241bdcfcf2980c"]],"info":"# addRow([row],onTop)\n\n`onTop=true`\n\nadds a new Row on top of the table"},{"id":"b496aa6a.32f2d8","type":"ui_button","z":"51e5d3061e86059f","name":"sort","group":"c91332c0.50c11","order":2,"width":0,"height":0,"passthru":false,"label":"sort","tooltip":"add a new row to the top","color":"","bgcolor":"","className":"","icon":"","payload":"[{\"column\":\"timestamp\",\"dir\":\"asc\"},{\"column\":\"text\",\"dir\":\"desc\"}]","payloadType":"json","topic":"setSort","topicType":"str","x":244,"y":1064,"wires":[["eb577b4b.510388"]]},{"id":"b54f6ce8.3b1a4","type":"debug","z":"51e5d3061e86059f","name":"addRow","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":520,"y":1120,"wires":[]},{"id":"c91332c0.50c11","type":"ui_group","name":"commands","tab":"379a501f.53b59","order":2,"disp":true,"width":"6","collapse":false},{"id":"379a501f.53b59","type":"ui_tab","name":"ui-table command","icon":"fa-table","disabled":false,"hidden":false}]
or you can can use initial sort with the ui_control.tabulatore property
Or
you can set a sort parameter to the column settings
p.s. the tabulator in ui-table is 4.4 documentation.