Show search box only

Show search box only

spidogrspidogr Posts: 23Questions: 9Answers: 0

Probably this has been asked before, but I cannot find an answer.
Is it possible for the table to be hidden and appear only after the user starts typing in the search box?
This is for a server side approach (mysql), so ideally, no request should be send to the server when the table initializes.

Answers

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin

    Hi,

    You can't use the search box that DataTables creates for that, but you can readily use your own search box to search DataTables through the search() method. Here is a little example: http://live.datatables.net/keteqiyo/1/edit .

    Allan

  • cyrus_elsesoftugcyrus_elsesoftug Posts: 3Questions: 0Answers: 0
    edited January 2022

    $(document).ready(function() {
    $('#your_tableID').DataTable( {

    } );
    

    } );

    May that could help you out. only that it keeps the pagination

  • cyrus_elsesoftugcyrus_elsesoftug Posts: 3Questions: 0Answers: 0

    ok!!! this then worked fine for me.
    disable pagination by doing this

    $(document).ready(function() {
        $('#You_tableID').DataTable( {
            "bPaginate": false
        } );
    } );
    
Sign In or Register to comment.