Why data table throwing this error - Uncaught TypeError: h[(k + g)][e] is undefined

Why data table throwing this error - Uncaught TypeError: h[(k + g)][e] is undefined

SmaithaRuSmaithaRu Posts: 1Questions: 1Answers: 0

Uncaught TypeError: h[(k + g)][e] is undefined.

const DatatableFixedColumns = function () {

// Basic Datatable examples
const _componentDatatableFixedColumns = function () {
    if (!$().DataTable) {
        console.warn('Warning - datatables.min.js is not loaded.');
        return;
    }

    // Setting datatable defaults
    $.extend($.fn.dataTable.defaults, {
        columnDefs: [{
            orderable: false,
            width: 100,
            targets: [2]
        }],
        dom: '<"datatable-header"fl><"datatable-scroll datatable-scroll-wrap"t><"datatable-footer"ip>',
        language: {
            search: '<span class="me-3">Filter:</span> <div class="form-control-feedback form-control-feedback-end flex-fill">_INPUT_<div class="form-control-feedback-icon"><i class="ph-magnifying-glass opacity-50"></i></div></div>',
            searchPlaceholder: 'Type to filter...',
            lengthMenu: '<span class="me-3">Show:</span> _MENU_',
            paginate: { 'first': 'First', 'last': 'Last', 'next': document.dir == "rtl" ? '&larr;' : '&rarr;', 'previous': document.dir == "rtl" ? '&rarr;' : '&larr;' }
        }
    });


    // Left and right fixed columns
    var table = $('.datatable-fixed-both').DataTable({
        columnDefs: [
            {
                orderable: false,
                targets: 2
            },
            {
                width:200,
                targets: 0
            },
            {
                width: '100%',
                targets: 1
            },
            {
                width: 200,
                targets: [2]
            },

        ],
        scrollX: true,
        scrollY: 350,
        scrollCollapse: true,
         fixedColumns: {
            leftColumns: 0,
            rightColumns: 1
        }, 
        "pageLength": 100,
        "order": [1],
        "columns": [
            { "data": "offer_id" },
            { "data": "name" },
            { "data": "description" },
            { "data": "startdate" },
            { "data": "enddate" },
            { "data": "apply_to" },
            { "data": "is_active" },


          /*   "offer_id":dt[i].offer_id,
            "name":dt[i].name,
            "description":dt[i].description,
            "startdate":dt[i].start_date,
            "enddate":dt[i].end_date,
            "apply_to":dt[i].apply_to,
            "is_active":dt[i].is_active,  

*/
],
"stripeClasses": [ 'odd-row', 'even-row' ]

    });

    table.column(0).visible(false);


};

// Return objects assigned to module

return {
    init: function () {
        _componentDatatableFixedColumns();
    }
}

}();

// Initialize module
// ------------------------------

document.addEventListener('DOMContentLoaded', function () {
DatatableFixedColumns.init();
});

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Are error will be coming from the Editor trial code. Are there any other error messages shown in the console?

    I don't see a trial for your account, so possibly you've used the Editor JS file directly from our site? That isn't possible - you need to download a trial.

    Allan

Sign In or Register to comment.