diff --git a/models/drive/src/index.ts b/models/drive/src/index.ts index 5781269186..0bc5efd3a8 100644 --- a/models/drive/src/index.ts +++ b/models/drive/src/index.ts @@ -23,6 +23,7 @@ import core, { AccountRole, IndexKind, Ref, + SortingOrder, DOMAIN_MODEL } from '@hcengineering/core' import { type Drive, type File, type Folder, type Resource, driveId } from '@hcengineering/drive' @@ -259,18 +260,25 @@ function defineResource (builder: Builder): void { { key: '', presenter: drive.component.ResourcePresenter, - label: drive.string.Name + label: drive.string.Name, + sortingKey: 'name' }, { key: '$lookup.file.size', presenter: drive.component.FileSizePresenter, - label: drive.string.Size + label: drive.string.Size, + sortingKey: '$lookup.file.size' }, { key: '$lookup.file.modifiedOn' }, 'createdBy' ], + options: { + sort: { + _class: SortingOrder.Descending + } + }, configOptions: { hiddenKeys: ['name', 'file', 'parent', 'path'], sortable: true diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index 9633410f65..ecf6fe2a20 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -139,7 +139,7 @@ objectsRecieved = true loading = 0 }, - { sort: getSort(sortKey), limit, ...options, lookup, total: false } + { limit, ...options, sort: getSort(sortKey), lookup, total: false } ) ? 1 : 0 @@ -155,7 +155,7 @@ (result) => { total = result.total }, - { sort: getSort(_sortKey), limit: 1, ...options, lookup, total: true } + { limit: 1, ...options, sort: getSort(_sortKey), lookup, total: true } ) const showContextMenu = async (ev: MouseEvent, object: Doc, row: number): Promise<void> => {