nextui
nextui copied to clipboard
[Feature Request] Allow multiple columns sorting on Table
Is your feature request related to a problem? Please describe.
The parameter sortDescriptor of Table only take one sorting descriptor, so we can't implement multicolumn sorting in tables, even if we implement our proper sort function. The problem is not that we can't do multicolumn sorting with our function but we can't display sort arrow on multiple sorted columns.
Describe the solution you'd like
It should be gread that sortDescriptor parameters allow to take a list to handle display of multicolumns sorting. Something like this:
export interface Sortable {
- sortDescriptor?: SortDescriptor,
+ sortDescriptor?: SortDescriptor[],
onSortChange?: (descriptor: SortDescriptor) => any
}
and of course all logic linked to it.
That should permit to do this:
const sortedColumns = [{column: "TITLE",direction: "ascending"}, {column: "NAME", direction: "descending"}] as sortDescriptor[]
<Table
selectionMode="multiple"
selectedKeys={selectedKeys}
onSelectionChange={setSelectedKeys}
aria-label="Articles"
sortDescriptor={sortedColumns}
onSortChange={(columnId) => sortTable(columnId)}
key={tableKey}
...props
>
...childs
</Table>
Describe alternatives you've considered
Screenshots or Videos
No response