I am using angular datatables and I have only one column.

When I bind it, the data comes in an ascneding order, while I want to display it in the order I recived it.

Can someone please help.

Controller :

        var vm = this;
        vm.dtOptions = DTOptionsBuilder.newOptions()
        .withButtons([
            'print',
            'pdfHtml5',

        ]);
        vm.dtColumnDefs = [
            DTColumnDefBuilder.newColumnDef(0).notSortable()
        ];

HTML :

  <div ng-controller="formViewController as frmView">
    <table datatable="ng" dt-options="frmView.dtOptions" dt-column-defs="frmView.dtColumnDefs" class="row-border hover">
        <thead>
            <tr>
                <td>
                    {{Title}}
                </td>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="plugin in newArray track by $index">
                <td>
                    //Content
                </td>
            </tr>
        </tbody>
    </table>
</div>
share|improve this question
3  
    
I already have what they say, I want to disable ordering, i.e. ascending-descending – Devanshi Parikh Nov 22 '16 at 8:05
up vote 1 down vote accepted

Look at order, formerly known as aaSorting. Add

.withOption('order', [])

to your dtOptions. The default value of order is [[0, 'asc']], setting it to [] will prevent dataTables from making an initial sort on the first column after initialisation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.