@@ -674,6 +674,7 @@ export const ContentList = <T extends GenericContent = GenericContent>(props: Co
674
674
}
675
675
676
676
const displayNameInArray = [ 'DisplayName' ]
677
+ const sortableColumns = [ 'DisplayName' , 'Path' , 'Type' , 'Name' , 'Version' , 'CreationDate' , 'ModificationDate' ]
677
678
678
679
return (
679
680
< div style = { { ...props . style , ...{ height : '100%' } } } { ...props . containerProps } >
@@ -720,11 +721,24 @@ export const ContentList = <T extends GenericContent = GenericContent>(props: Co
720
721
getSelectionControl = { getSelectionControl }
721
722
/* If the Order by Column Is The Display. The client will sort it. Due to some locale and indexing issues */
722
723
items = {
723
- currentOrder === 'DisplayName'
724
+ sortableColumns . includes ( String ( currentOrder ) )
724
725
? children ?. sort ( ( a , b ) => {
725
726
// If no display Name
726
- const nameA = a ?. DisplayName ?? '' // Provide a default value if displayName is undefined
727
- const nameB = b ?. DisplayName ?? '' // Provide a default value if displayName is undefined
727
+ const nameA = String ( a [ currentOrder ] ) ?? '' // Provide a default value if displayName is undefined
728
+ const nameB = String ( b [ currentOrder ] ) ?? '' // Provide a default value if displayName is undefined
729
+
730
+ if ( currentDirection === 'asc' ) {
731
+ return nameA . localeCompare ( nameB )
732
+ }
733
+ return nameB . localeCompare ( nameA )
734
+ } )
735
+ : currentOrder === 'CreatedBy' || currentOrder === 'ModifiedBy'
736
+ ? children ?. sort ( ( a , b ) => {
737
+ const aTmp = a [ currentOrder ] as GenericContent
738
+ const bTmp = b [ currentOrder ] as GenericContent
739
+
740
+ const nameA = String ( aTmp ?. DisplayName ) ?? ''
741
+ const nameB = String ( bTmp ?. DisplayName ) ?? ''
728
742
729
743
if ( currentDirection === 'asc' ) {
730
744
return nameA . localeCompare ( nameB )
0 commit comments