Show custom messages when using ajax option for localisation

Show custom messages when using ajax option for localisation

alleycatalleycat Posts: 2Questions: 0Answers: 0
edited April 2016 in Free community support

I am using datatables 1.9.3 and using the ajax option for localisation. I am setting the language file option with the dataTable defaults option so all the datatables in my website can use the strings in the language files.

$.extend(true, $jq.fn.dataTable.defaults, {
"oLanguage": {
"sUrl": "${request.contextPath}/json/i18n/"+<locale>+".lang"
}
});

However, I am not able to override the strings in the lang files to show custom messages for individual tables. For example, my English.lang file contains

{
"sEmptyTable": "No data available",
"sZeroRecords": "No matching records found",
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
},
"oAria": {
"sSortAscending": ": activate to sort column ascending",
"sSortDescending": ": activate to sort column descending"
}
}

But if I then try to override the message for sEmptyTable as below, it has no effect.

$('#example').dataTable( {
"oLanguage": {
"sEmptyTable": "No information available at this time. Please check later."
}

All the datatables always show "No data available" when the table is empty. I want to be able to show the translation for "No data available" as per the user language settings. In some instances though, I wish to show the user more information than just "No data available". Is there a way to achieve this in 1.9.3?

This discussion has been closed.