Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom warning message on table empty or no match found in jquery datatable

I have 2 data-table sharing the same jquery-dataTables-js because I cannot change it inside the JavaScript file, is there any alternate way that I can change it

I want to customize the default error message to my own.

No matching records found - We don't add anything yet No data available in table - no data of your choice.

like image 1000
user2691372 Avatar asked Nov 24 '13 22:11

user2691372


People also ask

How do I get rid of no matching records found Datatables?

simply remove dataSrc:"" from your ajax request. this worked for me in similar situation. Save this answer.

How do I change the default empty table message in DataTable?

DataTable({bFilter: false, bInfo: false, paging: false}); It works fine.

How check DataTable is empty in jquery?

You can also check if dataTable is empty using page.info() as described in this stackoverflow post.

How many rows can DataTable handle?

The maximum number of rows that a DataTable can store is 16,777,216.


1 Answers

check this which sets your custom messages.

$(document).ready(function() {
    $('#data_table_id').DataTable( {
        "language": {
            "lengthMenu": "Display -- records per page",
            "zeroRecords": "No matching records found - We don't add anything yet No data available in table - no data of your choice.",
            "infoEmpty": "No records available"
        }
    } );
} );
like image 102
sansarp Avatar answered Sep 25 '22 10:09

sansarp