File tree Expand file tree Collapse file tree
packages/vuetify/src/components/VDataTable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export const makeDataTableProps = propsFactory({
8585 ...makeDataTableItemsProps ( ) ,
8686 ...makeDataTableSelectProps ( ) ,
8787 ...makeDataTableSortProps ( ) ,
88- ...omit ( makeVDataTableHeadersProps ( ) , [ 'multiSort' ] ) ,
88+ ...omit ( makeVDataTableHeadersProps ( ) , [ 'multiSort' , 'initialSortOrder' ] ) ,
8989 ...makeVTableProps ( ) ,
9090} , 'DataTable' )
9191
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export const makeVDataTableHeadersProps = propsFactory({
6363 disableSort : Boolean ,
6464 fixedHeader : Boolean ,
6565 multiSort : Boolean ,
66+ initialSortOrder : String as PropType < 'asc' | 'desc' > ,
6667 sortAscIcon : {
6768 type : IconValue ,
6869 default : '$sortAsc' ,
@@ -117,9 +118,9 @@ export const VDataTableHeaders = genericComponent<VDataTableHeadersSlots>()({
117118 function getSortIcon ( column : InternalDataTableHeader ) {
118119 const item = sortBy . value . find ( item => item . key === column . key )
119120
120- if ( ! item ) return props . sortAscIcon
121-
122- return item . order === 'asc' ? props . sortAscIcon : props . sortDescIcon
121+ return ( ! item && props . initialSortOrder === 'asc' ) || item ?. order === 'asc'
122+ ? props . sortAscIcon
123+ : props . sortDescIcon
123124 }
124125
125126 const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor ( ( ) => props . color )
You can’t perform that action at this time.
0 commit comments