Merge pull request #188 from mabentley85/include-sort-direction-in-datatable-click-header-dispatch

Added the Sort Direction to the header click dispatch
This commit is contained in:
Eric Liu 2020-06-04 17:34:54 -07:00 committed by GitHub
commit 44c861a002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,10 +79,10 @@
<TableHeader
on:click={() => {
dispatch('click', { header });
dispatch('click:header', header);
let active = header.key === $sortHeader.key;
let currentSortDirection = active ? $sortHeader.sortDirection : 'none';
let sortDirection = sortDirectionMap[currentSortDirection];
dispatch('click:header', {header, sortDirection});
sortHeader.set({
id: sortDirection === 'none' ? null : $thKeys[header.key],
key: header.key,