TypeError: undefined is not an object (evaluating 'table.ajax.reload')
TypeError: undefined is not an object (evaluating 'table.ajax.reload')
I have a submitSuccess handler for an editor that finds the table to be undefined immediately after it is called. By using breakpoints I have determined that the table is defined on the line before the ajax.reload() call, but when I step into the call. the table is undefined. The handler is as follows:
taskEditor.on( 'submitSuccess', function (e,json,data,action) {
truth = true; // To facilitate a breakpoint
taskTable.ajax.reload( function() {
truth = true; // To facilitate a breakpoint
setTimeout( function() { // ajax.reload() is async, so needs a callback
taskTable.row( {selected: true} ).show().draw(false);
// Make the noteTable follow the taskTable updates
taskTable.rows().every(function() {
if (this.child.isShown()) {
updateChild(this);
}
} );
}, 10); // Delay here as a DT bug workaround
}, false);
} );
I have 3 other apps with very similar code, and one other one with this exact code, which do not exhibit this behavior.
I tried using the debugger, but I got errors in the process:
[Error] Failed to load resource: the server responded with a status of 404 () (index.js.map, line 0)
Failed to load resource: the server responded with a status of 404 ()
Failed to load resource: the server responded with a status of 404 ()
I'm not sure how to attack this problem, and would appreciate suggestions as to the problem, or how to proceed with this.
Thanks for looking at this
Answers
Hi @TomBajzek ,
The code looks fine, as it should, since you say it works as expected on other apps. Are you able to link to the page showing the issue?
Cheers,
Colin
I found and fixed this problem myself. For the record, there was a typo elsewhere in the code that had redefined taskTable, which I found by accident when working on changes to that other area of the program.
I'm sorry I bothered anyone before catching this myself. I think there is a lesson here about being too narrowly focused on a specific problem.