Devanshi Parikh Devanshi Parikh - 1 year ago 129
AngularJS Question

How to disable initial Ordering of data in Angular Datatables?

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()

vm.dtColumnDefs = [


<div ng-controller="formViewController as frmView">
<table datatable="ng" dt-options="frmView.dtOptions" dt-column-defs="frmView.dtColumnDefs" class="row-border hover">
<tr ng-repeat="plugin in newArray track by $index">

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download