Without 'language', API throws an error?

Without 'language', API throws an error?

princeofnaxosprinceofnaxos Posts: 26Questions: 9Answers: 0

I have a working dataTables with these options:

var table = $('.table-wrapper #table').DataTable({
        pageLength  : 25,
        language    : {
            url             : '/js/lib/dataTables/en_US.json',
            processing      : "Processing...",
            search          : "Search:",
            lengthMenu      : "Entries per page: _MENU_",
            info            : "Showing _START_ to _END_ of _TOTAL_ entries",
            infoEmpty       : "Showing 0 to 0 of 0 entries",
            infoFiltered    : "(filtered from _MAX_ total entries)",
            infoPostFix     : "",
            loadingRecords  : "",
            zeroRecords     : "No matching records found",
            emptyTable      : "No data available in table",
            paginate: {
                first       : "<i class='fa fa-first'></i>",
                previous    : "<",
                next        : ">",
                last        : ">>"
            },
            select: {
                rows: {
                    _: "{t}%d rows selected{/t}",
                    1: "{t}1 row selected{/t}"
                }
            }
        },
        data: {$users_json},
        rowId: 'id',
        columns: [
            { data: 'fullname', title: "<span class='checkbox-wrapper'><input type='checkbox' name='select-all'></span>{t}Name{/t}" },
            { data: 'email', title: "{t}Email address{/t}" },
            { data: 'locale', title: '<i class="fa fa-comment" title="{t}Language{/t}"></i>' },
            { data: 'props' },
            { data: 'dummy' },
            { data: 'auth_count', title: '<i class="fa fa-sign-in big" title="{t}Logins{/t}"></i>' }
        ],
        columnDefs: [
            { searchable: false, targets: [2,3,4] },
            { orderable: false, targets: 3 },
            { visible: {$customer.contract.is_trial}, targets: [4] }
        ],
        order: [[ 0, 'asc' ], [ 1, 'asc' ]],
        pagingType: "full_numbers",
        lengthMenu: [ [25, 50, 100, -1], [25, 50, 100, "{t}All{/t}"] ]
    })

    $('.table-wrapper table')
    .on('draw.dt', function () {  ...... })

I presumably doing something wrong, but when I remove 'language.url', the variable 'table' is undefined in the 'draw.dt' event.

Does that make any sense?

Answers

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    Looks okay to me. Please link to a test case showing the issue.

    Allan

This discussion has been closed.