Sorting natural-nohtml not working

Sorting natural-nohtml not working

irelevantirelevant Posts: 15Questions: 4Answers: 1
edited January 15 in Free community support

Hello,

i need to sort column 0 "Názov" as string. By default type its not working. I tried natural-nohtml but still not working. Here is screenshot of preview or sort.

My wrong sort:
IMG_20180727_121030.jpg
IMG_20180727_140931.jpg
IMG_20180727_115842.jpg
IMG_20180727_120503.jpg
IMG_20180727_145237.jpg

Right sort is:
IMG_20180727_115842.jpg
IMG_20180727_120503.jpg
IMG_20180727_121030.jpg
IMG_20180727_140931.jpg
IMG_20180727_145237.jpg

Here is example with few rows:
https://pastebin.com/CyL4h3zJ

Here is my script definition of table:
https://pastebin.com/B8LERv58

Here is the test case:
http://live.datatables.net/mafoyeja/1/

Thank you for any advice.

This question has an accepted answers - jump to answer

Answers

  • irelevantirelevant Posts: 15Questions: 4Answers: 1

    Ok. Its because of href values for some reasion. When I replaced href="FilesOpenid0036802ad2394b65a58b9d53bdc705cd" for href="test", its worked... But I dont really understand why and how to fix it.

  • irelevantirelevant Posts: 15Questions: 4Answers: 1

    Ok. When I removed type of the first column, everything working fine. But not on my site. I find that by remove this "$.fn.dataTable.ext.order.intl('sk');" everything working fine. Know someone what is the real problem?

  • colincolin Posts: 5,893Questions: 0Answers: 1,020
    edited January 15

    Hi @irelevant ,

    I just looked at your fiddle, thanks for that as it helps, and the ordering looks like it should to me. See image below.

    Could you give me steps on how to reproduce the problem, please, and say what you would expect the results to be.

    Cheers,

    Colin

  • irelevantirelevant Posts: 15Questions: 4Answers: 1

    O reply you but my answer is waiting for approve... I dont know why. I talked about this line "$.fn.dataTable.ext.order.intl('sk');". When I removed it everything working fine with this first colmn definition: "{ orderable: true, targets: 0 },". But I need it for sorting special character for my language. That external order working if cell not contain html code. When I removed all html in cells its working. But I need that html and external order.

  • colincolin Posts: 5,893Questions: 0Answers: 1,020

    Could you give instructions please on how to reproduce your problem on that fiddle, that would be the most useful to progress this. As it stands, I'm not seeing the problem reported so it's hard to understand the cause or to offer solutions.

  • irelevantirelevant Posts: 15Questions: 4Answers: 1

    Ok, my bad. I tried reproduce my problem into test case and I was successfull. Here: http://live.datatables.net/mafoyeja/2/
    And now describe.

    Code what I added is original implementation from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator
    I have script under html like in test case. But as you can see, sort not working correct. Again, thank you for your time.

  • tangerinetangerine Posts: 2,358Questions: 18Answers: 261

    Your <thead> is missing a closing </tr> tag.

  • tangerinetangerine Posts: 2,358Questions: 18Answers: 261

    Your <thead> is missing a closing </tr> tag.

  • irelevantirelevant Posts: 15Questions: 4Answers: 1

    @tangerine

    Yes, I fixed it but it not resolve my original problem.

  • irelevantirelevant Posts: 15Questions: 4Answers: 1
    Answer ✓

    Ok. I dont find a reasion of my problem but I found the way how to fix it. I used diacriticsMap and removeDiacritics function from plug-in https://datatables.net/plug-ins/sorting/diacritics-sort and implemented them into implemented natural sort functions from https://datatables.net/plug-ins/sorting/natural and now everything working excellent. :)

Sign In or Register to comment.