Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35368

would like some columns to be smart search with the state column being a drop down.

$
0
0

I have a table with one global search box, and 5 more search boxes for columns. Great tool. But now I would like the State column to be a drop down instead. then hide the state column. Here is my script so far.

<script type="text/javascript">
      function filterGlobal () {
    $('#mymatrixTable').DataTable().search(
        $('#global_filter').val(),
        // $('#global_regex').prop('checked'),
        $('#global_smart').prop('checked')
    ).draw();
}
 
function filterColumn ( i ) {
    $('#mymatrixTable').DataTable().column( i ).search(
        $('#col'+i+'_filter').val(),
        // $('#col'+i+'_regex').prop('checked'),
        $('#col'+i+'_smart').prop('checked')
    ).draw();
}
 
$(document).ready(function() {
    $('#mymatrixTable').DataTable( {
      responsive: true,
      dom: 'rtip',      
      "order": [[ 2, 'asc' ], [ 10, 'desc' ],[ 11, 'desc' ]]
    } );

     
 
    $('input.global_filter').on( 'keyup click', function () {
        filterGlobal();
    } );
 
    $('input.column_filter').on( 'keyup click', function () {
        filterColumn( $(this).parents('tr').attr('data-column') );
    } );
} );
    </script>

I am not sure where I found the example to create this.
Thanks in advance.


Viewing all articles
Browse latest Browse all 35368

Trending Articles