Get DataTable settings

Get DataTable settings

modmanmodman Posts: 2Questions: 0Answers: 0
edited January 2014 in DataTables 1.9
Hello, I'm having problems find out how to get settings of some datatable. I have
[code]
$dt = dataTable({ ... })
[/code]

I did figure out that I can use this hack
[code]
$dt.DataTable.settings[0]
[/code]
but it's of course not working if I'm adding tables dynamically.

I need to get this, so I can get mData name for cell that I click on

[code]
$vc.on('click', 'td', function(){
var cell_name = $dt
.DataTable.settings[0]
.aoColumns[$dt.fnGetPosition( this )[2]] // as I'm dynamically hiding columns, I get original position of column
.mData
[/code]

Is there any way to get settings for $dt or get mData for td clicked from existing API outside of datatable module?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Use fnSettings :-) .

    I should say that the settings object is considered to be private. Dynamically changing values in it absolutely is not supported (for example, you can't change mData as you need to change a bunch of getter and setter functions as well).

    Allan
  • modmanmodman Posts: 2Questions: 0Answers: 0
    Aaaaa! :) I have no idea how did this hide from my eyes :) Thank you! Yea, I don't need to change anything. Epic!
This discussion has been closed.