New Table component sorting by column not working

I have a new table component that is set to use pagination. My query grabs 50 records at a time and the table is set to a size to view only about 20 rows and the user can scroll to view the rest of the 50 and then use the pagination buttons to get the next page of rows. This works fine.

However, the sorting functionality is now not working. The visuals are there - I see the little arrow indicating the sort direction change, but the table is not sorted. Is this a known bug?

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!