Skip to main content

We need to access the “PieceWriterModel” after the condition has been applied. any attempt to read the data in a callback results in this error “f is not a function”. Any ideas?

PieceWriterModel = skuid.model.getModel(“MMA_Music_Piece_Writer”);       
var MusicPieceCondition = PieceWriterModel.getConditionByName(“MMA_Music_PieceId”);
        var PieceId = row.Piece__r.Id;
        console.log(PieceId);
        PieceWriterModel.setCondition(MusicPieceCondition,PieceId);
        PieceWriterModel.updateData({callback:function(result){
            console.log(PieceWriterModel);
                }});

Have you tried the jquery deferred syntax instead? It seems clearer to me:

skuid.$.when(PieceWriterModel.updateData()).then(function(){console.log(PieceWriterModel);});


var PieceWriterModel = skuid.model.getModel("MMA_Music_Piece_Writer");<br>var MusicPieceCondition = PieceWriterModel.getConditionByName("MMA_Music_PieceId");<br>var PieceId = row.Piece__r.Id;<br>console.log(PieceId);<br>PieceWriterModel.setCondition(MusicPieceCondition, PieceId);<br>$.when(PieceWriterModel.updateData())<br>&nbsp; &nbsp; .done(function() {<br>&nbsp; &nbsp; &nbsp; &nbsp; console.log('Success');<br>&nbsp; &nbsp; })<br>&nbsp; &nbsp; .fail(function() {<br>&nbsp; &nbsp; &nbsp; &nbsp; console.log('Error');<br>&nbsp; &nbsp; });

Thanks to you both! Matt, it worked.


Reply