Why is column().data() returning an array of dashes? ["-", "-", "-"]

Why is column().data() returning an array of dashes? ["-", "-", "-"]

subasicallysubasically Posts: 3Questions: 1Answers: 0

I have a table that is loading data with an ajax call, I am using dataSrc to manipulate the data before rendering it.

var opportunitiesTable = $('#opportunityList').DataTable({
  initComplete: function( settings, json ) {
    // Table loaded! Show what is in column 3
    console.log(this.api().column(3).data());
  },
  ajax: {
    url: "/ajax/opportunity/GetOpportunitiesByNetwork",
    dataSrc: function(res) {
      //console.log(res);
      if (typeof (res) === "object" && res.ResponseCode === 200) {
        opportunityData = res.Data;

        return opportunityData;
      } else {
        // Else show API error message
      }
    }
  }
});

What gets console logged

["-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", …]

Table renders correctly though...

Answers

This discussion has been closed.