Skip to content

Commit

Permalink
Use the order from the <DataHeaderCell> to update the <Datagrid> sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Luwangel committed Aug 3, 2020
1 parent 70a9274 commit b3a829a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ra-ui-materialui/src/list/Datagrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ const Datagrid: FC<DatagridProps> = props => {
event.stopPropagation();
const newField = event.currentTarget.dataset.field;
const newOrder =
currentSort.field === newField && currentSort.order === 'ASC'
currentSort.field === newField &&
event.currentTarget.dataset.order === 'ASC'
? 'DESC'
: 'ASC';
setSort(newField, newOrder);
},
[currentSort.field, currentSort.order, setSort]
[currentSort.field, setSort]
);

const handleSelectAll = useCallback(
Expand Down

0 comments on commit b3a829a

Please sign in to comment.