How to add custom warning message to table empty or not find match in jquery datatable

I have 2 data tables that use the same jquery-dataTables-js, because I cannot change it inside the JavaScript file, is there any other way I can change.

I want to set a default error message for my own.

No matches were found - we are not adding anything. There is no data in the table - no data of your choice.

+6
source share
3 answers

check it out, which sets up your custom posts.

$(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" } } ); } ); 
+17
source

See here http://datatables.net/usage/i18n editing standard text data. Also here is an example http://datatables.net/examples/basic_init/language.html

0
source

You can also do this in initComplete , as shown below. It is more flexible in terms of adding custom classes and designs.

 "initComplete": function(settings, json) { $('.dataTables_empty').html("<span class='label label-danger'>No records found</span>"); } 
0
source

Source: https://habr.com/ru/post/958742/


All Articles