0

I have a list of contacts which I am allowing users to add to. However, upon insertion of the new list, I I just get a blank space where the new contact is. Although upon screen refresh the recently added contact shows just fine.

    newContact: function(component, event, helper) {
    console.log('in the main controller');
    var con = component.get("v.newContact");
    var acct = component.get("v.selectedAccount");
    con.AccountId = acct.Id;
    var action = component.get("c.getNewContact");
        action.setParams({"con": con});
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                var returned =response.getReturnValue();

                var contactList = [];
                contactList.push(returned);
                for (var i = 0; i < acct.Contacts.length; i++) {
                    contactList.push(acct.Contacts[i]);
                }

                component.set('v.contactList', contactList);                    
                console.log('contactList '+ JSON.stringify(contactList));

                console.log("SUCCESS - : " + JSON.stringify(returned));
                $A.util.addClass(component, "hideModal");
             }
        });
        $A.enqueueAction(action);        

I really don't understand why it's not showing. any ideas?

2
  • What value is being returned by the server call (the 'returned' variable)? Is it the contact you're expecting? Or is that also blank? Feb 28, 2017 at 2:32
  • It's the value I'm expecting. I've printed it to the console log to check. Moreover, I checked the contents of the list and the new contact has been added to the list as well, just not displaying
    – Krone
    Feb 28, 2017 at 17:43

0

You must log in to answer this question.

Browse other questions tagged .