I am using the UI-Table 'Sending Commands' example - which is a great example that does pretty much everything I need. But when it reloads the table data from context store I find that the entries are are in the opposite order than I have entered them. I have an ID column that I can click on and have them re-ordered, but I would prefer to have this done automatically when the table is loaded - can anyone give me any ideas on how to have the ID column sorted ascending order on load.
I found this - UI-Table Date Sort - but it's not clear there how the sort code is sent to the table node to perform the sort. I have tried sending the following;
via a change node with msg.ui_control changed to the code above - but when I do that all the data in the table disappears so I am still not doing it correctly.
Indeed I never bothered with this feature (it was easy enough to manually click on the sort bar), hence the faq does not allow for it, but is something that would be nice.
Perhaps @Christian-Me might be able to shed some light ...
Sorry to say but it is not of the best examples for practical use. It is more a demo and not good designed as it only records table entries when the table is visible on the dashboard.
For handling all kinds of table related stuff look at the "ui-table handler" included in this example.
Here the context storage is placed before the table so it records entries when they arrive regardless if the table is visible or not and replays everything when the tab gets visible by ui_conrol.
I don`t know how the effect happens (are you using the add on top feature?) but perhaps experiment with Sort Order section here (Tabulator | JavaScript Tables & Data Grids) . Be carefull to read the docs for version 4.4! This is the version included in ui-table.
That should not happen. Please make sure that the message including msg.ui_control has either no msg.payloador valid data (perhaps use a change or function node with delete msg.payload). Sending ui_control should change the layout but not the data if no payload is send (but perhaps I have to do some tests)
Thanks to both @Bobo & @Christian-Me for your quick replies! I did try to delete the payload from my change node, but when I did that it didn't do anything, tried putting the delete payload before and after the msg.ui_control change but same result both ways. I also checked and I am adding each line of data to the end, not to top.
I took a look at ui_table handler, but it's a little beyond my current node-red knowledge, for my purposes I have modified the 'Sending Commands' example and it's doing everything I need except this ordering problem.
I ended up trying to create my table in a ui_template node and that is going well, as for my purposes it helps that the user can edit individual cells...having one issue but I will create a new topic for that....
I am still open to finding a way to fix the ordering issue with ui-table as it may come in handy for other projects.