Problem with language url and dom title
Problem with language url and dom title
Hi
I took dom_toolbar.html and added language url
$(document).ready(function() {
$('#example').dataTable( {
"dom": '<"toolbar">frtip',
"language": {
"url": "/datatables/extensions/i18n/english.lang"
}
});
$("div.toolbar").html('<b>Custom tool bar! Text/images etc.</b>');
} );
and the toolbar text will not show
Here is the english.lang file
{
"sEmptyTable": "No data available in table",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Show _MENU_ entries",
"sLoadingRecords": "Loading...",
"sProcessing": "Processing...",
"sSearch": "Search:",
"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"
}
}
Thanks in advance
This discussion has been closed.
Replies
Language url is using ajax with that comes a mandatory use of drawCallback if you do not want the formatting to be overridden by the ajax call back
Use the
initCompleteoption to insert the toolbar. The problem you are having with the above code is that the toolbar insert code is run before the table is ready, due to the Ajax loading of the language file.Allan
p.s. I've deleted the duplicate discussion.
Hi Allan.The
initCallbackgive me a 404. I have tried theinitCompleteand did not used to work, but now that I have clean my code for the new version it does work like thedrawCallback. ThanksSorry - it should be
initComplete- I've edited my post to reflect that.Allan