drupal 8 tablesorting not working I am using the code below in a custom drupal 8 module to produce a table but the table does not sort when I click on the header, although the little arrow changes direction and the url indicates the sort order is different.

$headers = array(
      array('data' =&gt; t('Name'), 'field' =&gt; 'name', 'sort' =&gt; 'desc'),
      array('data' =&gt; t('Date'), 'field' =&gt; 'changed_date')

      );          
$order = tablesort_get_order($headers);
         $sort = tablesort_get_sort($headers);
         $rows = array();
         foreach ($directoryData as $entry) {
          $rows[] = array(

             array('data' =&gt; $entry['name']),
             array('data' =&gt; $entry['changed_date']),


          );
       }
       $table_element = array(
            '#theme' =&gt; 'table',
            '#header' =&gt; $headers,
            '#rows' =&gt; $rows,
            '#empty' =&gt;t('Your table is empty'),
        );  

        $html=drupal_render($table_element);


Anyone know what i can do to debug why the sorting is not working?
the reason the sorting that comes with drupal core doesnt work is that it only works for query based content.  If the content is static or otherwise not query based that you need to sort you have the use the client side tablesorting.js as explained here http://tablesorter.com/docs/