Javascript for row id in field editor?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
This code for a custom field renderer with the Model se to "Act" says that it cannot find the ActId. What am I missing?

Thanks!
Anna


var params = arguments[0], $ = skuid.$;
var field = arguments[0];
var model = field.model;
var row = field.row;
console.log(row);
var Act = row.Name__r.Id;
var ActId = row.Name__r.Id;
console.log(ActId);
var NoOfActPerformers = 0;
var ActPerformers ='none';
var ActPerformerModel = skuid.model.getModel("MMA_Academy_Student_Event_Act_Performer");

ActPerformerModel.setCondition(ConditionForSpecificAct,Id);
ActPerformerModel.updateData(function(){
    NoOfActPerformers = ActPerformerModel.data.length;
    console.log(NoOfActPerformers);
        if(NoOfActPerformers>0){
                for(i=0;i<NoOfActPerformers;i++){
                    ActPerformers = ActPerformerModel.data[i].MMA_Student__r.Name;
                    console.log(' ActPerformers ' + ActPerformers);
                    HtmlString = HtmlString + '<br></br><br></br><div><ul><em><font size="3" style="font-family:Georgia">'+ '&nbsp;' + '&nbsp;' + '&nbsp;' + '&nbsp;'+ ActPerformers +'</em></ul></div>';
                    var cellElem = field.element;
                    cellElem.html(HtmlString);
                    
                }
       
        
        }
        
}); 
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Sounds like Name__r.Id is not being returned in the model. 
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb

If I am looking for the id of the row in the field editor, what would should I use?
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb
I figured it out. Some other issues were preventing it from loading. Nothing fun enough to share here though. Thanks!