Merge pull request #553 from OpenSignLabs/sorting_in_drive

fix: sorting by name issue in open-sign drive
This commit is contained in:
prafull-opensignlabs
2024-04-02 12:34:00 +05:30
committed by GitHub
2 changed files with 11 additions and 4 deletions
@@ -70,6 +70,7 @@ function DriveBody(props) {
return item;
});
props.setPdfData(updatedData);
props.sortingData(null, null, updatedData);
await axios
.put(
`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
@@ -214,8 +215,8 @@ function DriveBody(props) {
? true
: false
: selecFolderId
? false
: true;
? false
: true;
if (!checkExist) {
if (moveFolderId) {
updateData = {
+8 -2
View File
@@ -203,6 +203,7 @@ function Opensigndrive() {
const result = JSON.parse(JSON.stringify(res));
setPdfData((prev) => [...prev, result]);
sortingData(null, null, [result], true);
setNewFolderName();
setIsFolderLoader(false);
setIsFolder(false);
@@ -223,9 +224,13 @@ function Opensigndrive() {
const sortedBy = (appInfo, type, order) => {
if (type === orderName.Name) {
if (order === orderName.Ascending) {
return appInfo.sort((a, b) => (a.Name > b.Name ? 1 : -1));
return appInfo.sort((a, b) =>
a.Name.toLowerCase() < b.Name.toLowerCase() ? -1 : 1
);
} else if (order === orderName.Descending) {
return appInfo.sort((a, b) => (a.Name > b.Name ? -1 : 1));
return appInfo.sort((a, b) =>
a.Name.toLowerCase() < b.Name.toLowerCase() ? 1 : -1
);
}
} else if (type === orderName.Date) {
if (order === orderName.Ascending) {
@@ -724,6 +729,7 @@ function Opensigndrive() {
isList={isList}
setIsAlert={setIsAlert}
setSkip={setSkip}
sortingData={sortingData}
/>
{loading && (
<div style={{ textAlign: "center" }}>Loading...</div>