Getting list of column names

Getting list of column names

navet1ssnavet1ss Posts: 3Questions: 0Answers: 0

I am dynamically creating columns in the DataTable based on a user query. I set the "Title" and the "Name" in ColumnDefs with a script but I seem to lack the ability to read the "Name" attribute to find out what I set them to. Can anyone provide an example of how to get a list of column "Names" (not "Titles")?

Replies

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Good point - there isn't a public API way of doing this. You could use table.settings().aoColumns[].sName - where:

    • table is the API instance to the table,
    • settings() is settings()
    • [] is an array indicator (i.e. you'd need a loop to access all columns)

    As I say, this is not a public API. It could potentially change in future. But at the moment, its the best I've got!

    Allan

This discussion has been closed.