TypeError: 'undefined' is not an object (evaluating 'aoColumns[iCol].bVisible')

TypeError: 'undefined' is not an object (evaluating 'aoColumns[iCol].bVisible')

iainsiains Posts: 2Questions: 0Answers: 0
edited July 2013 in Bug reports
I have 7 tables on my page, they all have 2 fixed columns and on init I hide some of the columns they all run fine until I create a previously created table again when I get: TypeError: 'undefined' is not an object (evaluating 'aoColumns[iCol].bVisible') on line 5962 of the full stable version of datatables 1.9.4 this line is here: if ( aoColumns[iCol].bVisible == bShow )

If I remove the fixed Columns code (see immediately below) the problem goes away (but I need fixed columns!)

//fix left 2 columns
new FixedColumns( oTable, {
"iLeftColumns": 2
} );


I am using v 2.0.3 of fixed columns and have more issues with the 2.0.5 Dev version.

If I don't hide columns on init the problem also goes away. I hide by looping through the cols and doing this:

oTable.fnSetColumnVis(colsArray[i], show , false);

and on the last one this:

oTable.fnSetColumnVis(colsArray[colsLength-1], show , true)

I need a fix or pointing in the right direction please?

Replies

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Are you able to link us to a test case showing the issue please?

    Thanks,
    Allan
  • iainsiains Posts: 2Questions: 0Answers: 0
    Hi Allan - with a fresh head this morning I have resolved this by caching the raw table before applying DT to it, after destroying DT then clearing the DOM where the table was and reinserting the cached table then reapplying DT resolves the issue. It would appear that there was 'something' in the markup created by DT not cleared up by 'destroy' that caused the problem. Fantastic work BTW!
  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    That's interesting. I'll look over the destroy code and see if I can find anything wrong with it. If you see it again, a test case would be great so I can see and fix the error in DataTables.

    > Fantastic work BTW!

    Thank you :-)

    Allan
This discussion has been closed.