Ordering Table by column
You have to do this while defining the header array like

$header = array(
     array(
       'data'  =&gt; t('Url'),
       'field' =&gt; 'd.path',
       'sort'  =&gt; 'asc',
     ),
     array(
       'data'  =&gt; t('Text'),
       'field' =&gt; 'd.text',
     ),
    );


So, this table will have two columns, Url &amp; Text. And it will be sorted in ascending order by column Url.