Alphabetical Sorting Works with the Exception of the letter D

Alphabetical Sorting Works with the Exception of the letter D

spydergoateaterspydergoateater Posts: 2Questions: 1Answers: 0

So I was testing the sorting function for my 2-column table and I noticed that everything sorts properly, but the name that starts with D comes after the letter H for some reason. I've tried duplicating several times but it always comes after H and not C.

Answers

  • kthorngrenkthorngren Posts: 21,178Questions: 26Answers: 4,923
    edited March 2021

    The problem is specific to your data. Can you provide an example showing this? Please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • allanallan Posts: 63,219Questions: 1Answers: 10,416 Site admin

    Looking specifically at the "Dominion" one the issue is the data as Kevin suggests. If you look at most of the data it starts:

        <td><a href data-toggle="modal" data-target="#CreditGeneral">
     Credit General Insurance Company
    

    The Dominion row starts:

        <td><a href data-toggle="modal" data-target="#DominionInsurance">
    Dominion Insurance Company Of America
    

    It is really subtle, but there is a {space} before the Credit. There isn't for the Dominion. That is what is messing with your sorting.

    How are you generating that HTML? Are you able to remove the white space (including new lines) in the opening a of each cell in that column?

    Allan

This discussion has been closed.