Error Upgrading to v2 Uncaught TypeError: val.apply is not a function

Error Upgrading to v2 Uncaught TypeError: val.apply is not a function

adrianhhdadrianhhd Posts: 1Questions: 0Answers: 0
edited April 20 in Free community support

Debugger code (debug.datatables.net):

jquery.dataTables.min.js:6317 Uncaught TypeError: val.apply is not a function
    at jquery.dataTables.min.js:6317:16
    at Array.map (<anonymous>)
    at _fnCallbackFire (jquery.dataTables.min.js:6316:50)
    at _fnCreateTr (jquery.dataTables.min.js:3108:4)
    at _fnDraw (jquery.dataTables.min.js:3404:6)
    at _fnReDraw (jquery.dataTables.min.js:3500:3)
    at jquery.dataTables.min.js:4684:6
    at Object.callback [as success] (jquery.dataTables.min.js:4029:4)
    at fire (jquery-3.7.1.js:3223:31)
    at Object.fireWith [as resolveWith] (jquery-3.7.1.js:3353:7)

Error messages shown:

jquery.dataTables.min.js:6317 Uncaught TypeError: val.apply is not a function

Description of problem:

I have this datatable initialization code before upgrading to 2.0.5, and it's work smooth.

tableUser = $('#tableUser').DataTable({
            scrollX: true,
            scrollY: 300,
            scrollCollapse: true,
            fixedColumns: {
                left: 1,
                right: 1
            },
            ajax: {
                url: '<?= base_url('Employee/get_op_kandang') ?>',
                type: 'GET',
                data: {
                    id: OPERATOR_CODE,
                    department: "<?= $department ?> ",
                    position: "<?= $position ?> ",
                },
            },
            columnDefs: [{
                    targets: 0,
                    className: 'text-center',
                    data: null,
                    render: function(data, type, row, meta) {
                        return incrementDt(meta);
                    }
                },
                {
                    targets: 1,
                    data: 'NIK'
                },
                {
                    targets: 2,
                    data: 'ename'
                },
                {
                    targets: 3,
                    data: 'DepartmentDesc'
                },
                {
                    targets: 4,
                    data: 'PositionDesc'
                },
                {
                    targets: 5,
                    data: 'TitleDesc'
                },
                {
                    targets: 6,
                    data: 'GroupDesc'
                },
                {
                    targets: 7,
                    data: null,
                    // className: 'text-center',
                    render: function(data, type, row) {
                        return `<button class="btn btn-primary btn-sm" id="btn_d"><i class="mdi mdi-calendar-search"></i>Details</button>`
                    }
                },
            ],
        });

But, after upgrading to 2.0.5 it is become not working anymore. Ajax call seem not proplem too.. here is my ajax response:

Is I missing something? Thanks

Replies

  • allanallan Posts: 63,493Questions: 1Answers: 10,470 Site admin

    jquery.dataTables.min.js:6317

    There is no such file for v2. It was renamed to be dataTables.min.js.

    I don't see any issue with your initialization code. Can you link to a test case showing the problem please?

    Allan

Sign In or Register to comment.