.columns().names() is not a function

.columns().names() is not a function

nicontrolsnicontrols Posts: 32Questions: 16Answers: 1

I'm trying to get my column names:

table.columns().names()

My DataTable does have names:

columns: [           
    { name: "abc", ...},
    { name: "def", ...}
]

However I get the following error:

.columns(...).names is not a function

Am I missing something obvious?

This question has an accepted answers - jump to answer

Answers

  • nicontrolsnicontrols Posts: 32Questions: 16Answers: 1

    I've found the following that does what I'm after:

        var columns = table.settings().init().columns;
            table.columns().every(function(index) { 
            console.log(columns[index].name);
         })  
    
  • allanallan Posts: 63,468Questions: 1Answers: 10,466 Site admin
    Answer ✓

    That method isn't available in 1.x. It isn't in the documentation.

    It has however been committed into the v2 branch, but that is very early development. You wouldn't want to use it!

    Allan

This discussion has been closed.