Fix thKeys property

This commit is contained in:
Jorge Vergara 2022-06-12 17:47:45 -04:00
commit 1dac233219

View file

@ -144,13 +144,10 @@
};
const dispatch = createEventDispatcher();
const batchSelectedIds = writable(false);
const headerItems = writable([]);
const tableRows = writable(rows);
const thKeys = derived(headerItems, () =>
headers
.map(({ key }) => ({ key, id: key }))
.reduce((a, c) => ({ ...a, [c.key]: c.id }), {})
);
$: thKeys = headers
.map(({ key }) => ({ key, id: key }))
.reduce((a, c) => ({ ...a, [c.key]: c.id }), {});
const resolvePath = (object, path) => {
if (path in object) return object[path];
return path
@ -356,7 +353,7 @@
sortKey === header.key ? sortDirection : 'none';
sortDirection = sortDirectionMap[currentSortDirection];
sortKey =
sortDirection === 'none' ? null : $thKeys[header.key];
sortDirection === 'none' ? null : thKeys[header.key];
dispatch('click:header', { header, sortDirection });
}
}}"