TypeError

TypeError

moecmoec Posts: 6Questions: 5Answers: 0
edited December 2014 in Free community support

Hello all. I'm getting my info from a database, and I get the error TypeError: undefined is not an object (evaluating 'j[k].style').
Here is the code ajax code I'm using

$(document).ready(function() {
            var table = $('#example').DataTable( {
                "ajax": "includes/payroll.php",
                "columns": [
                    {
                        "className":      'details-control',
                        "orderable":      false,
                        "data":           null,
                        "defaultContent": ''
                    },
                    { "data": "empNum" },
                    { "data": "empName" },
                    { "data": "appFlag"},
                    { "data": "unitRate" },
                    { "data": "salary" },
                    { "data": "hourly"},
                    { "data": "appr1"},
                    { "data": "appr2"},
                    { "data": "appr3"},
                    { "data": "appr4"},
                    { "data": "appr5"}
                ],
                "order": [[1, 'asc']]
            } );

and here is an example of an array I'm returning from the database

{
    "data": [
        {
            "empNum": "1",
            "empName": "BAKER, MARK E. ",
            "unitRate": 0,
            "salary": 3282.84,
            "hourly": 0,
            "appFlag": " ",
            "app1": "K002 1 ",
            "app2": " ",
            "app3": " ",
            "app4": " ",
            "app5": " "
        }

I don't know what I'm doing wrong or how to fix this. I've been searching and trying for about 6 hours now. Please help

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Answer ✓

    Can you link to a page showing the issue (as required in the forum rules) or use the debugger so we have some more information to debug the issue with please.

    My guess is that the number of columns defined in the HTML does not match the number defined in your columns array (12).

    Allan

This discussion has been closed.