TypeError: undefined is not an object (evaluating 'a[j[i]]') in datatables.min.js:6006

TypeError: undefined is not an object (evaluating 'a[j[i]]') in datatables.min.js:6006

TomBajzekTomBajzek Posts: 131Questions: 30Answers: 1

I haven't been able to track this one down. I'm building a task management application uses a child table to display notes (known as comments in this case) related to a selected task, and allows users to comment on a task via a noteEditor launched from the child table. (This is parallel in structure to several other apps I've built with DataTables / Editor.) However, in this case, I need to send email notifications to people associated with the task whose email address is in the tasks table, but not in the notes table. When I submit the form to create the note, I get the above TypeError in datatables.min.js. Below are all snippets of code affecting the email1 form input:

In the beginning of the file:

$(document).ready(function() {
    var noteTable;
    var theScope;
    var theResponders;
    var theEmail1;

In the taskEditor for the tasks table:

                    "label": "Email1:",
                    "name": "email1",
                    "type": "readonly",
                    "className": "hidden"

In the dependent handler for extracting the email address and name together from the pulldown of responders:

    taskEditor.dependent('responder1', function(val, data, callback) {
        $.ajax( {
            url: './php/getResponder.php',
            dataType: 'json',
            data: { "responder": val },
            success: function( data ) {
                theEmail1 = data["values"]["email"];
                taskEditor.field('email1').input().val( theEmail1 );
                truth = true;
        } );
    } );

In the noteEditor for the notes table (where the notes.email is not stored in the notes table, but used to send a notification):

                            name: "notes.email1",
                            type: "hidden",
                            def: function() {
                                return theEmail1;

In the open handler for the noteEditor:

// Set-up the Note editor (create notes only, no editing)
        noteEditor.on('open', function(e,mode,action) {
            noteEditor.title('Create comment');
            noteEditor.field('notes.email2').val(rowData.email2);    // Breakpoint 1 here
        } );

Those are all of the references to email1 in the table.tasks.js file. (For purposes of this question, I'm only dealing with email1, and not yet using email2 or email3, which are to be handled in exactly the same way.

I've also set up a presubmit handler for the noteEditor just to allow me to see what's happened along the way:

        noteEditor.on('preSubmit', function(e, action) {
            truth = true;                                                   // Breakpoint 2 here
        } );

When I run this, the noteEditor opens for me to enter a note. at Breakpoint 1, I see that noteEditor.field('notes.email1').val() has the correct value. When I hit the submit button, the error occurs within datatables.min.js:6006, without Breakpoint 2 ever hitting.

I'm at a loss here as to what could be wrong, and as to how to debug this. I'd appreciate some help.


  • allanallan Posts: 50,737Questions: 1Answers: 7,581 Site admin

    If you could give me a link to the page showing the issue, that would be great. If that isn't possible, could you use the non-min version of the DataTables file, and show me the full backtrace from the error and also the header of the file (or the url if you are loading it form the CDN) so I can see what version it is. Line 6006 in the min file unfortunately doesn't tell me much.


Sign In or Register to comment.