Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1817

Mismatch in the number of fields

$
0
0
I am fetching data from a PHP Backend using the fnServerData option. For some reason, while drawing the table, one more column is being expected. I get this popup: "DataTables warning (table id = 'summary'): Requested unknown parameter '13' from the data source for row 0". I just have 13 columns so parameter 13 shouldn't even be there. After investigating further, I saw that before sending the data to fnCallback there were 13 fields for every row and on returning there were 14. Any ideas regarding what I could be doing wrong?

          "fnServerData": (sSource, aoData, fnCallback) ->
            $.getJSON(sSource, aoData, (json) ->
              for data in json.aaData
                len = data.length
                console.log len //output 13
              fnCallback(json)
            )
            "fnDrawCallback": (oSettings) ->
            table = that.$("#summary").dataTable()
            cols = table.fnSettings().aoColumns.length
            console.log cols  //output 14
            col = 0
            while col < cols
              if that.shownFields.indexOf(col) == -1
                table.fnSetColumnVis(col, false)
              else
                table.fnSetColumnVis(col, true)
              col++

variable shownfields has been initialized with [0,1,2,3,4,5,6]

Viewing all articles
Browse latest Browse all 1817

Latest Images

Trending Articles



Latest Images