From 568aed0c0b2836d9b97eb7b2a13048e5fbee187e Mon Sep 17 00:00:00 2001 From: Anish Aggarwal Date: Sat, 7 Mar 2020 01:39:40 +0530 Subject: [PATCH] added for schema --- src/components/datagrid/column_sorting.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/datagrid/column_sorting.tsx b/src/components/datagrid/column_sorting.tsx index 48d6eda0e67..f56b15203e5 100644 --- a/src/components/datagrid/column_sorting.tsx +++ b/src/components/datagrid/column_sorting.tsx @@ -34,7 +34,6 @@ export const useColumnSorting = ( ): ReactNode => { const [isOpen, setIsOpen] = useState(false); const [avilableColumnsisOpen, setAvailableColumnsIsOpen] = useState(false); - // prune any non-existant/hidden columns from sorting useEffect(() => { if (sorting) { @@ -227,7 +226,12 @@ export const useColumnSorting = ( const nextColumns = [...sorting.columns]; nextColumns.push({ id, - direction: defaultSortDirection || 'asc', + direction: + defaultSortDirection || + (schemaDetails(id) && + schemaDetails(id)! + .defaultSortDirection) || + 'asc', }); sorting.onSort(nextColumns); }}>