Outputting sortable tables from a Static Content Macro


I develop a macro which outputs tables onto Confluence pages and I’d like to make the tables sortable like they are with tables manually inserted into Confluence pages.
I know this is achievable using Dynamic Content Macros and AUI or another framework but I don’t want to use a Dynamic Content Macro because those can only be loaded over GET requests which means I cannot get access to the macro body in the preview screen (as the history API returns a 404 because the page hasn’t been saved yet). Whereas Static Content Macros can access the body in preview mode because they can use POST as the renderingMethod and receive the entire body in preview mode regardless of how big it is.
Anyway, is there a way maybe be adding some classes to my table by which the Javascript already running in the Confluence page would detect my table and make it sortable, like manually inserted Confluence tables are?



1 Like

Hi @matthew.grover,

I’m not aware of how this might work. My only suggestion is to try to inspect a current page with a table and try to replicate all of the classes in your table creation to see if that works for you.

Also, another consideration is maybe to look into Forge as a way to generate your table. This works without an iFrame and might be able to get around the issue of not being able to get the content.