columns (and column) undefined

columns (and column) undefined

tonycarreontonycarreon Posts: 6Questions: 1Answers: 0

datatables.net 1.10.3

the following code results in an error "Object doesn't support property or method 'column'". i get essentially the same error if i try columns() instead.

for (i = 0; i < 6; i++)
tbl.column(i).visible(false);

but the following works:
for(i = 0; i < 6; i++)
tbl.fnSetColumnVis(i, false);

Replies

  • tonycarreontonycarreon Posts: 6Questions: 1Answers: 0

    stupid developer (me) error...

    more code:

    the problem was how i declared the tbl variable.

    var tbl = $("mytable").dataTable({ ... });

    tbl.column(0) // this was the problem.

    // but this works

    var tbl = $("#mytable").DataTable();

    tbl.column(0).visible(false);

This discussion has been closed.