From b419d03340ac42f099c81938bf5adb45d805261b Mon Sep 17 00:00:00 2001 From: wahyuun Date: Wed, 11 Oct 2023 17:06:34 +0700 Subject: [PATCH] sorting asc by name --- src/views/SimproV2/CreatedProyek/DialogHierarchy.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js index 7c1f99a..a6ac1b1 100644 --- a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js +++ b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js @@ -16,6 +16,7 @@ import { useTranslation } from 'react-i18next'; import { async } from '@dabeng/react-orgchart'; import { Link } from 'react-router-dom'; import { use } from 'i18next'; +import _ from 'lodash'; const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { const token = localStorage.getItem("token") const HEADER = { @@ -154,7 +155,8 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek .catch((error) => error.response); if (result && result.status == 200) { - setDataHierarchy(result.data.data); + const sortedData = _.orderBy(result.data.data, ['name'], ['asc']); + setDataHierarchy(sortedData); } else { NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!'); } @@ -340,4 +342,4 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek } -export default DialogHierarchy; +export default DialogHierarchy;