A collection of customer information (Image1 - unsorted) is being displayed in a table format, with the ability for users to sort the table by clicking on the headers. When the user clicks on the Customer Name header for the first time (Image2), the list is sorted alphabetically from A-Z based on the customer names. Clicking on the Customer Name header a second time (Image3) will reverse the order to Z-A.
However, there seems to be an issue when the user clicks on the Customer Name header for the third time (Image4). The expectation was to see the list reordered in its original A-Z order as seen in Image2. Unfortunately, this does not happen and the list remains in an A-Z order, but not the same as previously observed in Images 2 and 3.
if (this.orderByColSide)
authList.sort((a, b) => a.customerCode.toLowerCase() > b.customerCode.toLowerCase() ? 1 : -1);
else
authList.sort((a, b) => a.customerCode.toLowerCase() > b.customerCode.toLowerCase() ? -1 : 1);
https://i.sstatic.net/bnmxS.jpg
https://i.sstatic.net/S5nO8.jpg