1

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.

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

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}
                });
           }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.