oSettings.aoColumns[i] is undefined

oSettings.aoColumns[i] is undefined

codemonkcodemonk Posts: 24Questions: 0Answers: 0
edited December 2012 in DataTables 1.9
Hello everyone, I have changed my development environment , and have migrated my work over to my server. I've already had many issues with my REST web-service which i have hopefully fixed. In any case, This was created using datatables 1.9.1 and jquery-ui 1.8.2. I am now using datatables 1.9.4 and jquery-ui 1.9.2. And this is the error im getting (it get triggered when you edit a row)

[code]
TypeError: oSettings.aoColumns[i] is undefined
[Break On This Error]

var col_id = oSettings.aoColumns[i].sTitle;
[/code]

please take a look at it. all the code is available under the source HTML, however for easy access here is my code:

[code]
//Sets Selected Row
var SelectedRow = fnGetSelected(oTable);

if(SelectedRow.length !== 0 ) {
var col_name = [];
var row_sel = oTable.fnGetData(SelectedRow[0]);
var oSettings = oTable.fnSettings();
console.log(oSettings.aoColumns);

//Grabs Column Names
for(var i=0; i

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I don't get that error on loading the page. Just a 2 column table with 'Testing' in it.

    Allan
  • codemonkcodemonk Posts: 24Questions: 0Answers: 0
    edited December 2012
    it gets triggered when you hit the edit row button, assuming you have selected a row already.

    UPDATE: after poking around some more i noticed,

    [code] var row_sel = oTable.fnGetData(SelectedRow[0]);[/code]

    This returns the 2 more than it should. Which is very odd. If i have 3 rows, which in this case i do, it returns 3 rows, and 2 null rows. any ideas? Ive added some console.logs for debugging.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    There are two null columns in the result from fnGetData - is that what you are concerned about?

    It looks like it is coming from your server-side processing script:

    [code]
    {
    "sEcho": 1,
    "iTotalRecords": "1",
    "iTotalDisplayRecords": "1",
    "aaData": [
    [1, "Testing", 1, "Yes", null, null]
    ]
    }
    [/code]

    is the return I get on load.

    The DataTable appears to only have 4 columns defined, so DataTables is ignoring the two two entries in the array (the two nulls).

    Allan
  • codemonkcodemonk Posts: 24Questions: 0Answers: 0
    wow i am blind, that is the first thing i checked, i guess i completely over looked it.thanks!
This discussion has been closed.