Problem sorting numbers bigger than 999.999 with "." as thousands separator

Problem sorting numbers bigger than 999.999 with "." as thousands separator

Berlin1066Berlin1066 Posts: 2Questions: 1Answers: 0

Using version 1.10.19. Tried with plain numbers as well.
Rows are sorted ok except the ones with values beyond 999.999,00

var dtnc = $("#dt-propiedades-listar").DataTable(
// Opciones
{
"ajax": '/path/',
"processing": true,
"paging": true,
"deferRender": true,
"columns": [
{"data": "select"},
{"data": "imagenes"},
{"data": "referencia"},
{"data": "propiedad_provincia"},
{"data": "propiedad_localidad"},
{"data": "propiedad_subtipo"},
{"data": "habitaciones_totales"},
{"data": "banios_totales"},
{"data": "metros_totales"},
{"data": "venta_precio"},
{"data": "alquiler_precio"},
{"data": "temporada_precio"},
{"data": "traspaso_precio"},
{"data": "modificado"},
{"data": "visible"},
{"data": "disponible"},
{"data": "compartido"},
{"data": "links"}
],
"select": {
style: 'multi',
selector: 'td:first-child input',
blurable: false,
className: 'selected'
},
"stateSave": true,
"language": {
"url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/Spanish.json"
},
"columnDefs": [
{
"targets": 0,
"searchable": false,
"sortable": false

            },
            {
                "targets": 1,
                "searchable": false,
                "sortable": false

            },
            {
                "targets": 6,
                "className": "text-right"
            },
            {
                "targets": 7,
                "className": "text-right"
            },
            {
                "targets": 8,
                "className": "text-right"
            },
            {
                "targets": 9,
                "className": "text-right",
                "type": "num-fmt"
            },
            {
                "targets": 10,
                "className": "text-right",
                "type": "num-fmt"
            },
            {
                "targets": 11,
                "className": "text-right",
                "type": "num-fmt"
            },
            {
                "targets": 12,
                "className": "text-right",
                "type": "num-fmt"
            },
            {
                "targets": -1,
                "searchable": false,
                "sortable": false
            },
            {
                "targets": -2,
                "className": "text-right"
            },
            {
                "targets": -3,
                "searchable": false,
                "className": "text-right"
            },
            {
                "targets": -4,
                "searchable": false,
                "className": "text-right"
            },
            {
                "targets": -5,
                "searchable": false,
                "className": "text-right"
            }],
        "order": [[2, "desc"]],
        "rowCallback": function (row, data) {
            // Set the checked state of the checkbox in the table
            $('input.selectRow', row).prop('checked', data.active == 1);
        },
        "initComplete": function () {
            load_quick_view();
        }
    }

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @Berlin1066 ,

    It's working here, so it's possible there's some non-numeric data in your dataset.

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • Berlin1066Berlin1066 Posts: 2Questions: 1Answers: 0
    edited January 2019

    Hi @colin you are right, I forgot to link the test cases, I'll do next time. With your link I found that the decimal and thousands operators goes inside "language". Thank you!

This discussion has been closed.