Error: aoColumns[srcCol] is undefined _fnSortFlatten

Error: aoColumns[srcCol] is undefined _fnSortFlatten

mkotharimkothari Posts: 1Questions: 1Answers: 0

Hi,

I am getting "Error: aoColumns[srcCol] is undefined _fnSortFlatten" exception. Please help.
I am using AngularJS v1.5.7.

HTMLcode:

<div class="datatable" style="height: 800px;"  >
            <table datatable=""  dt-instance="auditController.dtInstance"dt-options="auditController.dtOptions"
                style="background-color: #08948c"
                dt-columns="auditController.dtColumns" style=""
                class="table table-striped table-bordered"></table>

</div>

CONTROLLER CODE

var app = angular.module('app', ['ngRoute','datatables','datatables.bootstrap','datatables.buttons']);

app.controller('auditController',['$scope','$log','DTOptionsBuilder','DTColumnBuilder','$http', function($scope,LOGGER,DTOptionsBuilder,DTColumnBuilder,$http)
{
var vm = this;
var startDate= $("#datepicker").val();
var endDate=$("#datepickerend").val();

                         vm.dtOptions = DTOptionsBuilder.newOptions()
                               //  vm.dtOptions = DTOptionsBuilder..newOptions()
                              .withOption('ajax', {         
                              contentType: 'application/json',
                               dataType: 'json',
                                        type: 'GET',
                                        data: function (d) {
                                            d.startDate = $("#datepicker").val();
                                            d.endDate = $('#datepickerend').val();
                                        },
                                        url: "auditDetails"     



                           }).withDataProp('data')
                               .withDOM('frtip')
                              .withOption('processing', true)
                              .withOption('serverSide', true)
                              .withOption('scrollX', 215)
                              .withOption('scrollX', 200)
                              .withBootstrap()      
                              .withPaginationType('full_numbers')
                            .withButtons([

                                          'excel',
                                          'colvis',
                                          'copy',
                                          'print',

                                      ]);

                            vm.dtColumns = [

                                        DTColumnBuilder.newColumn('requestDate').withTitle('Requested Date'),
                                        DTColumnBuilder.newColumn('requestBy').withTitle('Requested By'),
                                        DTColumnBuilder.newColumn('requestType').withTitle('Requested Type'),
                                        DTColumnBuilder.newColumn('OCN').withTitle('OCN').withOption('defaultContent', 'N/A'),
                                        DTColumnBuilder.newColumn('BCN').withTitle('BCN').withOption('defaultContent', 'N/A'),
                                        DTColumnBuilder.newColumn('existingValue').withTitle('Existing Value').withOption('defaultContent', 'N/A'),
                                        DTColumnBuilder.newColumn('newValue').withTitle('New Value').withOption('defaultContent', 'N/A'),
                                        DTColumnBuilder.newColumn('status').withTitle('status').withOption('defaultContent', 'N/A') 
                            ];  
                            vm.dtInstance = {};



                            }]);

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I can't help with the Angular aspect, but if you link to a page showing the issue I can take a look and see if I can spot the issue.

    Allan

This discussion has been closed.