New Table component sorting by column not working

Hi Barry! With server-side paginated tables (as your table seems to be set up), it's best to apply server-side sorting -- I'm guessing you want to sort your entire data set instead of just the page.

You can do this by accessing the sortArray property on the table to get the currently table's active sort (indicated via headers), and then use that property in your query to sort the data.

image

If your resource has prepared statements disabled, you can reference these directly in your query like so:

SELECT * FROM example_table ORDER BY {{table1.sortArray[0].columnId}} {{table1.sortArray[0].direction}} ...

This forum post also has information on dynamically setting sort with prepared statements on.

More features will be coming soon that help with configuring both client-side and server-side sorting on tables. Hope this helps!

1 Like