Column Count

Column Count

graygray Posts: 5Questions: 0Answers: 0
edited July 2012 in General
Hi there,

Is there a way to return the number of columns from the initial table? I'm using fnSetColumnVis and the JavaScript I am using to count the columns is reporting less after I hide some of the columns.

I'm a newbie, so please be gentle. :-)

Graham.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    [code]
    table.fnSettings().aoColumns.length
    [/code]

    will get you the number of columns ( http://datatables.net/docs/DataTables/1.9.1/DataTable.models.oSettings.html#aoColumns ).

    It could be wrapped up into an API method to make it a bit easier: http://datatables.net/blog/Creating_feature_plug-ins

    Allan
  • graygray Posts: 5Questions: 0Answers: 0
    Thanks Allan! Appreciated.... [thumbs]
This discussion has been closed.