AUI Sortable Table Edit Rows

I’m using AUI’s sortable table and I’m removing and adding new rows to this table. After this modification, sort operations reverting older rows. Is there a way to clean this sorting cache or reintialize this sorting feature after modifiying table?

1 Like

Hi @masterkeylog!

Under the hood, AUI uses a jQuery plugin called “tablesorter” to provide the sorting behaviour. Specifically, AUI uses v2.17.7 of Mottie’s fork of tablesorter.

According to the docs of the modded tablesorter plugin, you can cause the table to re-sort itself by doing the following:

$(theTableElement).trigger("update", [true]);

You can see their docs for an example of dynamically adding data to a table and re-sorting it:

They also have an example of combining the two tasks of (1) adding a new row, then (2) sorting the table. See the example here:

AUI’s documentation does not make this clear, so I’ve raised AUI-4720 and AUI-4721 to improve the situation.