• Resolved philipt18

    (@philipt18)


    I have a table where the items are numbered 1-40. I wanted to be able to sort by those numbers, so I had them in a column of the table. When I tried to sort, however, it was sorting 1,10,11 etc. instead of 1,2,3 etc. I figured its sorting as text, so as a quick fix I tried to change the first ten numbers to 01,02,03,04, etc. When I viewed the table the first four numbers were missing. I went back to the table, and sure enough the first four cells that had the numbers were blank. When I clicked into one of them, it said undefined. I tried adding back the 01, etc. but it still did the same thing. 05-09 were fine. I could type 05 into one of the cells, and it would work, but if I changed it to 01, I would get undefined again.

    So two questions. Is there a way to sort a column as numbers? That would probably be the easiest. Second, what the heck is going on with 01,02,03,04?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter philipt18

    (@philipt18)

    Okay, so I found the datatables sorting plug-in, which seems to work. However, how do I set it so blank cells show up last instead of first. I tried using an x assuming x would sort after numbers, but it did not.

    Thread Starter philipt18

    (@philipt18)

    I came up with a solution. I switched the sorting to html-num, and used an invisible html character ­ in the cells I wanted at the end.

    Probably still a good idea to figure out why 01,02,03,04 are undefined.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi!

    Thanks for your post and sorry for the trouble!

    Let’s look at the “undefined” problem first: Are you using any browser add-ons like “Language Tool” or similar (e.g. for spell checking and similar)? I have seen cases in the past where such browser add-ons caused this problem, as they don’t seem to properly detect the input fields.

    As for the number sorting: Are these really just the plain numbers 1-40 in that column? Then, these should be sorted correctly. Or are there cells in that column that contain anything else (like HTML code or text/letters)? Then, we would indeed look into a modified sorting here. Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.