Sign up ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

I know one can easily change the default config for empty message during the table init.

 DTDefaultOptions.setLanguage({sEmptyTable:' custom'})

I have a page where I reload the table content from a http call and promise when based on user changing filtering parameters. I was wondering if it's possible to change the empty message so that the text reflects error in http call and no results in the database.
It looks like the code is static.How could I extend the native angular-datatables code to allow changing the empty message after table initialisation.

share|improve this question

2 Answers 2

Thanks for the reply but it doesn't work for angular. I ended up doing something like this

       if($.fn.DataTable.settings.length > 0){
            $.fn.DataTable.settings[0].oLanguage['sEmptyTable'] = errorMessage ;
       }else{
                 $.extend(true, $.fn.dataTable.defaults, {
                    oLanguage: {'sEmptyTable': errorMessage}
                });
           }
share|improve this answer

Table cell with empty message has class dataTables_empty. If you want to display a message other than "No data available in table", you can use the code below:

$('#example .dataTables_empty').text('Error: Unable to load data');

See this jsFiddle for code and demonstration.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.