-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sort by FIO, but dont render in table
- Loading branch information
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class SortArr { | ||
sort(arr, order) { | ||
if (order === "sortByFioАscending") { | ||
arr.sort(this.sortByFioАscending); | ||
} else if (order === "sortByFioDescending") { | ||
arr.sort(this.sortByFioDescending); | ||
} else if (order === "sortByDateFromАscending") { | ||
arr.sort(this.sortByDateFromАscending); | ||
} else arr.sort(this.sortByDateFromDescending); | ||
console.log(arr); | ||
} | ||
sortByFioАscending(personA, personB) { | ||
if (personA.name > personB.name) { | ||
return 1; | ||
} else if (personA.name < personB.name) { | ||
return -1; | ||
} | ||
} | ||
sortByFioDescending(personA, personB) { | ||
if (personA.name < personB.name) { | ||
return 1; | ||
} else if (personA.name > personB.name) { | ||
return -1; | ||
} | ||
} | ||
sortByDateFromАscending(personA, personB) { | ||
if (personA.dateFrom > personB.dateFrom) { | ||
return 1; | ||
} else if (personA.dateFrom < personB.dateFrom) { | ||
return -1; | ||
} | ||
} | ||
sortByDateFromDescending(personA, personB) { | ||
if (personA.dateFrom < personB.dateFrom) { | ||
return 1; | ||
} else if (personA.dateFrom > personB.dateFrom) { | ||
return -1; | ||
} | ||
} | ||
} | ||
|
||
export default SortArr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,7 @@ | |
.past { | ||
background-color: #f8d7da !important; | ||
} | ||
.fa { | ||
margin-left: 5px; | ||
font-size: 20px; | ||
} |