Getting the DataTable instances

You can use the directive dt-instance where you provide a variable that will be populated with the DataTable instance once it's rendered:

Or you can provide a callback function(dtInstance) instead in the dt-instance directive:

The dtInstance variable will be populated with the following value:

{ "id": "foobar", "DataTable": oTable, "dataTable": $oTable, "reloadData": function(callback, resetPaging), "changeData": function(newData), "rerender": function() }

The first DataTable instance ID is: {{ showCase.dtInstance1.id }}

The second DataTable instance ID is: {{ showCase.dtInstance2.id }}

The first DataTable instance ID is: {{ showCase.dtInstance1.id }}

The second DataTable instance ID is: {{ showCase.dtInstance2.id }}

angular.module('showcase.dtInstances', ['datatables']).controller('DTInstancesCtrl', DTInstancesCtrl); function DTInstancesCtrl(DTOptionsBuilder, DTColumnBuilder) { var vm = this; vm.dtInstances = []; vm.dtOptions1 = DTOptionsBuilder.fromSource('data.json') .withDisplayLength(2) .withPaginationType('full_numbers'); vm.dtColumns1 = [ DTColumnBuilder.newColumn('id').withTitle('ID'), DTColumnBuilder.newColumn('firstName').withTitle('First name'), DTColumnBuilder.newColumn('lastName').withTitle('Last name') ]; vm.dtInstance1 = {}; vm.dtOptions2 = DTOptionsBuilder.fromSource('data1.json'); vm.dtColumns2 = [ DTColumnBuilder.newColumn('id').withTitle('ID'), DTColumnBuilder.newColumn('firstName').withTitle('First name'), DTColumnBuilder.newColumn('lastName').withTitle('Last name').notVisible() ]; vm.dtInstance2 = {}; vm.dtInstanceCallback = dtInstanceCallback; function dtInstanceCallback(dtInstance) { vm.dtInstance2 = dtInstance; } }