Order by timestamp dataTables Angular jS

0

Hi, I want to create a table with the following values:

controllerScope.logsData = {
    ajax: {
        url: '/api/organizations/'+$rootScope.organization.id+'/alerts?type=logevent',
        dataSrc: '',
        beforeSend: function (xhr) {
           xhr.setRequestHeader("Authorization", AuthService.authToken());
        }
    },
    columns: [
        {"data":"timestamp", render: function(data,type,row){
            return $filter('date')(row.timestamp, 'dd-MM-yyyy HH:mm:ss');
        }},
        {"data":"data.serial","defaultContent":""},
        {"data":"data.type","defaultContent":""},
        {"data":null, "orderable":false, "render":function(data){
            if(data.data.body){
                return JSON.stringify(data.data.body);
            } else {
                return '';
            }
        }}
     ],
    order: [[0, 'desc']]

However this ordering is not working ... Can anyone help?

    
asked by anonymous 16.02.2017 / 12:08

1 answer

0

An alternative is to change the date mask to:

'yyyy-MM-dd HH:mm:ss'
    
16.02.2017 / 12:25