# With the DataTables ColReorder

The `angular-datatables` also provides an API in order to make the plugin `ColReorder` work with datatables.

You need to add the file `angular-datatables.colreorder.min.js` to your HTML file.

You also need to add the dependency `datatables.colreorder` to your Angular app.

See the API for the complete list of methods of the helper.

<tabset>

angular.module('showcase.withColReorder', ['datatables', 'datatables.colreorder']) .controller('WithColReorderCtrl', WithColReorderCtrl); function WithColReorderCtrl(DTOptionsBuilder, DTColumnBuilder) { var vm = this; vm.dtOptions = DTOptionsBuilder.fromSource('data.json') .withPaginationType('full_numbers') // Activate col reorder plugin .withColReorder() // Set order .withColReorderOrder([1, 0, 2]) // Fix last right column .withColReorderOption('iFixedColumnsRight', 1) .withColReorderCallback(function() { console.log('Columns order has been changed with: ' + this.fnOrder()); }); vm.dtColumns = [ DTColumnBuilder.newColumn('id').withTitle('No move me!'), DTColumnBuilder.newColumn('firstName').withTitle('Try to move me!'), DTColumnBuilder.newColumn('lastName').withTitle('You cannot move me! *evil laugh*') ]; }
</tabset>