Skip to main content
deleted 28 characters in body
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

I'm having an issue where .setCallback is not functioning . Everytime I delete an account here is the image . Itit doesn't work.

here is the image

Here is my attribute
<aura:attribute name="deleteholder" type="String" />

and

<aura:attribute name="deleteholder" type="String" /> 

and here is my JS controller

 deleteAcc: function(component, event, helper){
        var row= event.getParam("row");
        component.set("v.deleteholder", JSON.stringify(row.Id));     
        var deletethis = component.get("v.deleteholder");
        var action2 = component.get("c.deleteAcc");
        console.log(deletethis);
       action2.setParams({ 
            "accid": deletethis
        });
        alert("Test2");
        action2.setCallback(this, function(response) {
            var state = response.getState();
            alert(state);
            if (state === "SUCCESS") {
                alert("Success delete");
                var rows = component.get("v.acc");
                var rowIndex = rows.indexOf(row);
                rows.splice(rowIndex, 1);   
                component.set("v.acc", rows);
            }else{
                alert("Test callback");
            }
        });
        $A.enqueueAction(action2);
        
    }

and here is my apex controller```

and here is my apex controller


Note: The issue is that the button is working fine , I think the issue is coming from the setParams or the setCallback. I don't have any idea what is wrong. I tried to re-do the codes but still having the same issue.

Note: The issue is that the button is working fine , I think the issue is coming from the setParams or the setCallback. I don't have any idea what is wrong. I tried to re-do the codes but still having the same issue.

I'm having an issue where .setCallback is not functioning . Everytime I delete an account here is the image . It doesn't work.

Here is my attribute
<aura:attribute name="deleteholder" type="String" />

and here is my JS controller

 deleteAcc: function(component, event, helper){
        var row= event.getParam("row");
        component.set("v.deleteholder", JSON.stringify(row.Id));     
        var deletethis = component.get("v.deleteholder");
        var action2 = component.get("c.deleteAcc");
        console.log(deletethis);
       action2.setParams({ 
            "accid": deletethis
        });
        alert("Test2");
        action2.setCallback(this, function(response) {
            var state = response.getState();
            alert(state);
            if (state === "SUCCESS") {
                alert("Success delete");
                var rows = component.get("v.acc");
                var rowIndex = rows.indexOf(row);
                rows.splice(rowIndex, 1);   
                component.set("v.acc", rows);
            }else{
                alert("Test callback");
            }
        });
        $A.enqueueAction(action2);
        
    }

and here is my apex controller```

Note: The issue is that the button is working fine , I think the issue is coming from the setParams or the setCallback. I don't have any idea what is wrong. I tried to re-do the codes but still having the same issue.

I'm having an issue where .setCallback is not functioning . Everytime I delete an account it doesn't work.

here is the image

Here is my attribute

<aura:attribute name="deleteholder" type="String" /> 

and here is my JS controller

deleteAcc: function(component, event, helper){
    var row= event.getParam("row");
    component.set("v.deleteholder", JSON.stringify(row.Id));     
    var deletethis = component.get("v.deleteholder");
    var action2 = component.get("c.deleteAcc");
    console.log(deletethis);
   action2.setParams({ 
        "accid": deletethis
    });
    alert("Test2");
    action2.setCallback(this, function(response) {
        var state = response.getState();
        alert(state);
        if (state === "SUCCESS") {
            alert("Success delete");
            var rows = component.get("v.acc");
            var rowIndex = rows.indexOf(row);
            rows.splice(rowIndex, 1);   
            component.set("v.acc", rows);
        }else{
            alert("Test callback");
        }
    });
    $A.enqueueAction(action2);
    
}

and here is my apex controller

Note: The issue is that the button is working fine , I think the issue is coming from the setParams or the setCallback. I don't have any idea what is wrong. I tried to re-do the codes but still having the same issue.

Source Link

Salesforce Apex-controller server side won't run - Lightning Component

I'm having an issue where .setCallback is not functioning . Everytime I delete an account here is the image . It doesn't work.

Here is my attribute
<aura:attribute name="deleteholder" type="String" />

and here is my JS controller

 deleteAcc: function(component, event, helper){
        var row= event.getParam("row");
        component.set("v.deleteholder", JSON.stringify(row.Id));     
        var deletethis = component.get("v.deleteholder");
        var action2 = component.get("c.deleteAcc");
        console.log(deletethis);
       action2.setParams({ 
            "accid": deletethis
        });
        alert("Test2");
        action2.setCallback(this, function(response) {
            var state = response.getState();
            alert(state);
            if (state === "SUCCESS") {
                alert("Success delete");
                var rows = component.get("v.acc");
                var rowIndex = rows.indexOf(row);
                rows.splice(rowIndex, 1);   
                component.set("v.acc", rows);
            }else{
                alert("Test callback");
            }
        });
        $A.enqueueAction(action2);
        
    }

and here is my apex controller ```
@AuraEnabled
public static void deleteAcc(String accid){
    System.debug('Test in');
    try{
    Account acc = [SELECT Id FROM Account WHERE Id =: accid];
    delete acc;
    }catch(Exception eMessage){
      
        System.debug(eMessage.getMessage());
    }
              
}

Note: The issue is that the button is working fine , I think the issue is coming from the setParams or the setCallback. I don't have any idea what is wrong. I tried to re-do the codes but still having the same issue.