Get column settings from the API

Get column settings from the API

AzaretAzaret Posts: 17Questions: 2Answers: 0

So I'm finally moving my datatables from 1.9 to 1.10, there is nice new features, but I also get confuse on some stuff I need to port. Here's one.

I've some tables where I do individual column filtering.
Often the last column is full of buttons, and no filters are needed on those columns.

While on 1.9, I used to select the columns where I should generate filters with jQuery and classes, I thought getting on 1.10 I could do something more generic and only based on datatable. So I made something based on the snippet from there http://datatables.net/examples/api/multi_filter_select.html which use datatable API.
But I don't want to generate an input for all columns, but only those which are searchable.

I have in my settings like :

columnDefs:   [{
  targets:    -1,
  searchable: false,
  sortable:   false
}]

But I'm not able to find a way when doing api.columns().every() so I could ignore not searchable columns.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Currently there is no public API to determine if a column is searchable or orderable I'm afraid. That is something I need to add. At the moment you need to continue using classes.

    Allan

  • AzaretAzaret Posts: 17Questions: 2Answers: 0

    In case it helps, I did some coding about that :)
    https://github.com/DataTables/DataTables/pull/703

This discussion has been closed.