Skip to content

[Feature Request] VDataTable should have the option to display a default sort icon on sortable column headers #21069

@cojohnson1999

Description

@cojohnson1999

Problem to solve

Currently, v-data-table has no way of rendering a placeholder sort icon in a column header to indicate to users that the column in a data table can be sorted. As it is right now, you can only see that a column is sortable by hovering over its header. If you want to add a default sort icon, you'd currently have to use the #headers slot and recreate the entire header of the table to accommodate the change... which seems like overkill.

Users of the website I'm building indicated that they weren't aware that headers could be sorted without a default icon, until they were instructed to click on a header to sort the table by that column. That would indicate to me that this is enough of a use case to warrant having the option to show show a default sort icon on a header if the sortable prop of the header is true.

Proposed solution

Include a default-sort-icon prop on v-data-table and v-data-table-server that renders a default sort icon when provided with a value. That prop should provide a default sort icon on sortable headers when included. Headers that are not sortable should not render a default icon. If the prop is not included on the table, no sort icon should be shown to maintain current data table functionality.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions