Hi Alex,
the sorting feature is not automatically available because it is added by some script in Confluence's web resources. Check out the HTML
source your browser receives from the server and you'll see that the respective CSS classes are not in there either.
If your theme already includes the Confluence web resources you only need to add this to your viewport theme (typically in the HTML <head>):
$page.resources.require('com.atlassian.confluence.plugins.confluence-sortable-tables:sortable-table-resources')
If not you'll either need to include them or add a custom table sorter script.
See here for adding Confluence web resources to a viewport theme:
https://help.k15t.com/scroll-viewport/referencing-js-css-and-image-files-74711193.html#ReferencingJS/CSSImageFiles-UsingConfluenceMacrosandcomponents
Cheers,
Jens