Reply To: Inline Editing

Forums vLooup for SharePoint Inline Editing Reply To: Inline Editing

#15860
avala
Participant

See attached image for how the vLookup table looks. This table is automatically populated ahead of time.

One person, the meeting leader, updates the form throughout the meeting. In this instance, they mark each attendee as “Absent” or “Attended” as needed throughout the meeting. This means they would update multiple rows in the vLookup table per session.

This script halfway works; I’m sure I’m missing something obvious. The first condition will alert correctly and update the vLookup value correctly. The second condition will alert correctly, but not update the vLookup value. This holds true if I switch conditional values or use an “Else” instead of “Else If” statement.

It would be nice if clicking the link refreshes the vLookup table, but is not necessary.


function doUpdateChildExample(elm,id){
    var statusVar = spjs.utility.getItemByID({"listName":"TF Attendees","id":id,"viewFields":["Attendance"]});
    alert(statusVar.Attendance);
    
    if (statusVar="Absent"){
        var attendVar= "Attended";
    } else if (statusVar="Attended"){
        var attendVar= "Absent";
    }
	var res = spjs.utility.updateItem({"listName":"TF Attendees","id":id,"data":{"Attendance": attendVar}});
        if(res.success){
            $(elm).replaceWith("<span style='font-size:16px;color:green;font-weight:bold;'>✓</span>");
        }else{
            $(elm).replaceWith("<span title='"+res.errorText+"' style='font-size:16px;color:red;font-weight:bold;'></span>");
        }
    }
  • This reply was modified 7 years, 1 month ago by avala. Reason: minor text fix and new image