Show empty table on start

Show empty table on start

dwbiz05dwbiz05 Posts: 7Questions: 0Answers: 0
edited May 2013 in General
OK, I have a datatable that is loaded initially with all the data it needs.
However, I want the users to search for data and not scroll.
Is there any way to "hide" the data until the user uses the search function?

Dave

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    That's searching, rather than filtering (i.e. building up from an empty set, rather than reducing down from the full set). DataTables implements filtering. If you wanted to do a search you'd need to remove the data from the DataTable and then only add it when you are ready to do the filtering. There is no built in 'search' option in DataTables (just 'filtering').

    Allan
  • dwbiz05dwbiz05 Posts: 7Questions: 0Answers: 0
    edited May 2013
    This worked fine for me:

    [code]
    "fnDrawCallback": function( oSettings ) {
    if($('#vehicles_table_filter input').val() != ''){
    $('#vehicles_table tr').css("display","");
    }
    else {
    $('#vehicles_table tr').css("display","none");
    }
    }
    [/code]

    Thanks!

    Dave
This discussion has been closed.