mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 04:02:15 +01:00
add secondary name sorting as tie breaker in client and project tables
This commit is contained in:
@@ -44,11 +44,14 @@ const projectCountMap = computed(() => {
|
|||||||
return map;
|
return map;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Name is always the secondary sort so rows with equal values render
|
||||||
|
// alphabetically instead of in API (created_at) order.
|
||||||
const sorting = computed<SortingState>(() => [
|
const sorting = computed<SortingState>(() => [
|
||||||
{
|
{
|
||||||
id: props.sortColumn,
|
id: props.sortColumn,
|
||||||
desc: props.sortDirection === 'desc',
|
desc: props.sortDirection === 'desc',
|
||||||
},
|
},
|
||||||
|
...(props.sortColumn !== 'name' ? [{ id: 'name', desc: false }] : []),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
|||||||
@@ -57,12 +57,15 @@ const clientNameMap = computed(() => {
|
|||||||
return map;
|
return map;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Convert sort props to TanStack Table format
|
// Convert sort props to TanStack Table format.
|
||||||
|
// Name is always the secondary sort so rows with equal values render
|
||||||
|
// alphabetically instead of in API (created_at) order.
|
||||||
const sorting = computed<SortingState>(() => [
|
const sorting = computed<SortingState>(() => [
|
||||||
{
|
{
|
||||||
id: props.sortColumn,
|
id: props.sortColumn,
|
||||||
desc: props.sortDirection === 'desc',
|
desc: props.sortDirection === 'desc',
|
||||||
},
|
},
|
||||||
|
...(props.sortColumn !== 'name' ? [{ id: 'name', desc: false }] : []),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Define column accessors for sorting.
|
// Define column accessors for sorting.
|
||||||
|
|||||||
Reference in New Issue
Block a user