How to remove filters from specific columns

How to remove filters from specific columns

hhhjjjkkklllhhhjjjkkklll Posts: 7Questions: 4Answers: 0

hi,

I want to remove filters from some columns.

I tried changing their Tags which i use to set the filters but it's no use.

Can anyone help me.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited May 2014 Answer ✓
  • hhhjjjkkklllhhhjjjkkklll Posts: 7Questions: 4Answers: 0
    edited May 2014

    Sorry that i didn't provide much info , still i will provide the answer i found.

      $("#example thead td").each( function ( i ) {
    
            if(i>1)
             select = $('<select class="form-control"><option value=""></option></select>')
                .appendTo( $(this).empty() )
                .on( 'change', function () {
                    table.column( i )
                        .search( $(this).val() )
                        .draw();
                } );
    
            table.column( i ).data().unique().sort().each( function ( d, j ) {
    
            if(i>1)
                select.append( '<option value="'+d+'">'+d+'</option>' )
            } );
        } );
    

    I just gave the condition of i>1 so that my first 2 columns will not have the filters.

This discussion has been closed.