Problems with multi-column-order

Problems with multi-column-order

SchmakusSchmakus Posts: 15Questions: 10Answers: 0

Hi Allan,

ich have a problem with multi-column-ordering. At first glance everything seems to be ok, but if I change to the last page, there are rows which are not in the correct order.

Here's my Code:

var table_show_showing_page =   $('#table_show_showing_page').DataTable( {
        "lengthMenu": [ [15, 25, 50, -1], [15, 25, 50, "All"] ],
        "ajax": {
            "url": "ajax/table.show.showing.page.php",
        },
        "deferRender": true,
        "order": [ [ 6, 'desc' ],[ 7, 'asc' ]],
        "language": { "url": "js/german.js"},
        "columns": [
            { "data": "ident", "orderable": false },
            { "data": "serial", "orderable": false, "visible": false, "searchable": false },
            { "data": "customer", "orderable": false },
            { "data": "project", "orderable": false },
            { "data": "cat", "orderable": false },
            { "data": "subcat", "orderable": false },
            { "data": "prio", "orderable": false, className: "prio_landing" },
            { "data": "date_start", "orderable": false},
            { "data": "date_end", "orderable": false, "visible": false},
            { "data": "duration", "orderable": false, "visible": false},
            { "data": "latest", "orderable": false, "visible": false},
        ],
        "searchCols": [
                null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
    { "search": "1" }
  ],
    "initComplete": function() { 
        $( ".dataTables_filter" ).append( '<button class="btn btn-primary paddingLeft" type="button" data-toggle="collapse" data-target="#table-show-options" aria-expanded="false" aria-controls="table-show-options">Optionen</button>' );
        this.api().columns().every( function () {
                                        var column = this;
                                        var select = $('<select><option value=""></option></select>')
                                                .appendTo( $(column.footer()).empty() )
                                                .on( 'change', function () {
                                                        var val = $.fn.dataTable.util.escapeRegex(
                                                                $(this).val()
                                                        );
         
                                                        column
                                                                .search( val ? val : '', true, false )
                                                                .draw();
                                                } );
         
                                        column.data().unique().sort().each( function ( d, j ) {
                                                select.append( '<option value="'+d+'">'+d+'</option>' )
                                        } );
                                } );
    }
    });

Here's my generated table:

7818.974.716_00882777   tbd tbd Funktionsteam     Eingang   Prio    17.04.2015 14:14
7828.974.192_00002899   tbd tbd Funktionsteam     Eingang   Prio    21.04.2015 09:56
7828.974.192_00002898   tbd tbd Funktionsteam     Eingang   Prio    21.04.2015 09:57
7828.974.563_00000243   tbd tbd Funktionsteam     Eingang   Prio    22.04.2015 08:28
7818.988.466_00000106   tbd tbd Funktionsteam     Eingang               10.04.2015 14:47
7818.988.548_00000101   tbd tbd Funktionsteam     Eingang               13.04.2015 14:19
7818.988.548_00000102   tbd tbd Funktionsteam     Eingang               13.04.2015 14:19
7818.974.521_00000103   tbd tbd Funktionsteam     Eingang               14.04.2015 12:09
7818.974.842_00000110 tbd tbd   Funktionsteam     Eingang               21.04.2015 09:54
7828.974.315_00078760   tbd tbd Funktionsteam     Eingang               21.04.2015 11:33
7828.974.315_00078759   tbd tbd Funktionsteam     Eingang               21.04.2015 11:34
7818.974.994_00067548   tbd tbd Funktionsteam     Eingang               21.04.2015 11:35
7818.974.992_00127774   tbd tbd Funktionsteam     Eingang               21.04.2015 11:36
7828.974.189_00000735   tbd tbd Funktionsteam     Eingang               22.04.2015 13:45
7818.974.991_00946202   tbd tbd Funktionsteam     Eingang               23.04.2015 07:50
7828.974.130_00000557                   Funktionsteam     Eingang               24.03.2015 13:53
7828.974.129_00000552                   Funktionsteam     Eingang               24.03.2015 13:54
This discussion has been closed.