Uncaught TypeError: object is not a function

I have a JS mass action that works great, I call updateData() inside of a save callback. If I leave the updateData() as is, it works fine. However if I change updateData() into a callback, i get an error that: Uncaught TypeError: object is not a function. here’s my code:

var params = arguments[0];var $ = skuid.$;
var records = skuid.$.map(arguments[0].list.getSelectedItems(),function(item){ 
return item.row.Id; 
}); 
var EDIHistory = params.model;
//notify user of progress
$.blockUI({
message:‘Resubmitting’
});

for (var n in records) {
var row = EDIHistory.getRowById(records[n]);
EDIHistory.updateRow(row, ‘Manually_Resubmit__c’, ‘true’);
}
//save the model and wait for success
EDIHistory.save({callback:function(result){

if (result.totalsuccess){
// update the data
            EDIHistory.updateData({callback:function(result){
                if (result.totalsuccess){
                    $.unblockUI();
                }
            }});
}
else{
alert(“Something went wrong!”);
}
}});

Is there something wrong with the placement of the “$.umblockUI()”? What is the issue here?

Hey Moshe,

The updateData function expects a function. You are currently passing in an object with a callback function defined. Try the following instead:

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EDIHistory.updateData(function(result){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (result.totalsuccess){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.unblockUI();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });

Hi Moshe, this is an unfortunate inconsistency in our API, that we hope to remedy at some point.  I think we would start out by supporting the syntax that you tried to use, but for now, you have to just send in a function like JD said.

Thanks Guys.