Change record status: 
Published
Project: 
Introduced in branch: 
8.8.x
Introduced in version: 
8.8.0
Description: 

A column's table can be configured to be sorted as 'asc' or 'desc' when it is clicked for first time by adding the 'initial_click_sort' parameter in the table header.

For example, if the “Member for” column should be sorted in descending order when clicked and the access data in ascending order then the header should look like this:

$header = [
      'username' => [
        'data' => $this->t('Username'),
        'field' => 'name',
      ],
      'member_for' => [
        'data' => $this->t('Member for'),
        'field' => 'created',
        'initial_click_sort' => 'desc'
      ],
      'access' => [
        'data' => $this->t('Last access'),
        'field' => 'access',
        'initial_click_sort' => 'asc'
      ],
    ];

If the parameter is omitted the default sort is 'asc'.

Impacts: 
Module developers
Themers
Distribution developers
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done