How to get the orderable and searchable values for each column when using callbacks and api?

How to get the orderable and searchable values for each column when using callbacks and api?

kmd1970kmd1970 Posts: 36Questions: 8Answers: 1
edited January 2016 in DataTables 1.10

https://datatables.net/examples/api/multi_filter_select.html

i would like to expand on the example above by only adding select boxes for columns marked searchable.

$(document).ready(function() {
    $('#example').DataTable( {
        initComplete: function () {
            this.api().columns().every( function () {
               var column = this;
              
              //this does not work and/or does not exist
               var searchable = column.searchable():

               if (searchable){
                ....do something......
               }
        }
    } );
} );

Replies

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

    does not exist

    is correct. You won't find it in the documentation. It is a method I'm going to add in future, but at the moment you would need to use a class name or something that you can query external to DataTables.

    Allan

  • kmd1970kmd1970 Posts: 36Questions: 8Answers: 1

    Thanks again!

This discussion has been closed.