Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82305

How do I use the dom function to hide search box?

$
0
0

Hi
I understand accord to the following link I can use the dom function to hide the search box
[https://datatables.net/forums/discussion/22511/can-you-hide-the-search-box-without-disabling-searching]

Where is the dom function located please? is it buried within JavaScript somewhere? Have never used this before I am slightly lost as how to implement it?

Currently I set my table up with the script below. I want to keep the bit that lets me have the three search boxes below my table. I just want to permanently hide the main default search box. Thank you for your help
Chazza

  <script>
        var dataSet = %ALARMSTABLE%;

        $(document).ready(function () {

            // Setup - add a text input to each footer cell
            $('#altable tfoot th').each(function () {
                var title = $(this).text();
                $(this).html('<input type="text" placeholder="Search ' + title + '" />');
            });

            // DataTable
            var table = $('#altable').DataTable({                
                data: dataSet,                
                initComplete: function () {
                    // Apply the search
                    this.api().columns().every(function () {
                        var that = this;

                        $('input', this.footer()).on('keyup change clear', function () {
                            if (that.search() !== this.value) {
                                that
                                    .search(this.value)
                                    .draw();
                            }
                        });
                    });
                }
            });
         });
    </script>



Viewing all articles
Browse latest Browse all 82305

Trending Articles