Problem with language url and dom title

Problem with language url and dom title

jfrjfr Posts: 71Questions: 24Answers: 0
edited July 2014 in DataTables 1.10

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

Replies

  • jfrjfr Posts: 71Questions: 24Answers: 0

    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

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    edited August 2014

    Use the initComplete option 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.

  • jfrjfr Posts: 71Questions: 24Answers: 0

    Hi Allan.The initCallback give me a 404. I have tried the initComplete and did not used to work, but now that I have clean my code for the new version it does work like the drawCallback. Thanks

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Sorry - it should be initComplete - I've edited my post to reflect that.

    Allan

This discussion has been closed.