Global sortable defaults for table

Global sortable defaults for table

jannijanni Posts: 4Questions: 1Answers: 0

Hi,
I have recently started using this plugin and I am very amazed with the features offered by this. I am currently using the sorting functinality for Swedish alphabets and found that it was not sorting correctly. I was just wondering is there any global sorting options that is available to use?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,352Questions: 1Answers: 10,443 Site admin

    Try this plug-in. I haven't written it up in a blog post yet (will do soon) and it isn't yet on the DataTables CDN, but its just a few lines of code that make it possible to use the new i18n API in Javascript with DataTables' sorting.

    Let me know how you get on with it!

    Allan

  • jannijanni Posts: 4Questions: 1Answers: 0

    Hi allan,
    thabks for your quick response.
    Here is the example fiddle. I am using alphabets (Å, Ä, Ö) which is getting sorted in wrong order.

    https://jsfiddle.net/ouu231w7/2/

  • allanallan Posts: 63,352Questions: 1Answers: 10,443 Site admin
    Answer ✓

    It looks like you've got the plug-in code included, but not activated. Have a read through the comments at the top of the file I linked to, which has examples on how to use it as well.

    Allan

  • jannijanni Posts: 4Questions: 1Answers: 0

    Oops. Sorry for it. Thanks for the plugin and it works perfect :)

  • allanallan Posts: 63,352Questions: 1Answers: 10,443 Site admin

    Awesome - that's great to hear. Its something I'm going to consider for direct inclusion in DataTables core in future.

    Allan

  • jannijanni Posts: 4Questions: 1Answers: 0

    Hej Allan,
    I have problem in making it work in my project. I am a bit confused with optional arguments that is passed. could you please help with it.? I am calling the plugin first and then before I initialize my datatable. I am wondering if I have to pass any arguments locale or Collator(which is confusing)

    $.fn.dataTable.ext.order.intl();
    $(function () {

          $('.example-datatable').DataTable( {
                "language": {"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Swedish.json"}
    } );
    
This discussion has been closed.