mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-10-25 11:17:28 +02:00 
			
		
		
		
	Change the SortFiles Method, so it works with the filesWithUniqueID Array
This commit is contained in:
		
							parent
							
								
									0e262dc2bd
								
							
						
					
					
						commit
						36192ba560
					
				| @ -132,15 +132,15 @@ document.getElementById("sortByDateBtn").addEventListener("click", function () { | ||||
| }); | ||||
| 
 | ||||
| function sortFiles(comparator) { | ||||
|   // Convert FileList to array and sort
 | ||||
|   const sortedFilesArray = Array.from(document.getElementById("fileInput-input").files).sort(comparator); | ||||
|   // Sort the filesWithUniqueId array
 | ||||
|   const sortedFilesArray = filesWithUniqueId.sort((a, b) => comparator(a.file, b.file)); | ||||
| 
 | ||||
|   // Refresh displayed list
 | ||||
|   displayFiles(sortedFilesArray); | ||||
| 
 | ||||
|   // Update the files property
 | ||||
|   const dataTransfer = new DataTransfer(); | ||||
|   sortedFilesArray.forEach((file) => dataTransfer.items.add(file)); | ||||
|   sortedFilesArray.forEach((fileObj) => dataTransfer.items.add(fileObj.file)); | ||||
|   document.getElementById("fileInput-input").files = dataTransfer.files; | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user