1

I try to add the possibility to order by column in the header of my table element.

I started to use Drupal 8 and I can't find any clear documentation about table on the API site to do what i want...

Thanks in advance.

0

You have to do this while defining the header array like

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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.