0

javascript side:

RemoveClick: function(component, event, helper) {
    var selCont = event.getParam("selectedJob");
    var conts = component.get("v.wrplst");
    var contsval = JSON.stringify(conts);
    alert('contsval value::::' + contsval);
    var Selndex = conts.indexOf(selCont);
    alert('selIndex value :::' + Selndex);
    var DeleteLen = conts.length;
    //alert('deleteLen value::::' + DeleteLen);
    var removeAction = component.get("c.removeRow");
    removeAction.setParams({
        "wrvalue": contsval,
        "rowval": Selndex,
    });
    removeAction.setCallback(this, function(g) {
        var state = g.getState();
        if (state == 'SUCCESS') {
            alert('success value');
        } else if (state === 'error') {
            alert('error value');
        }
    });
    $A.enqueueAction(removeAction);
}

server:

 @AuraEnabled
public static List <WrapperCriteria > removeRow(string wrvalue,integer rowval){
    system.debug('::::: rowToRemove val  :::::'+rowval);

  List < WrapperCriteria > warpList = (List < WrapperCriteria > ) JSON.deserialize(wrvalue, List<WrapperCriteria >.class);
    system.debug('::::::wrList value::::' + warpList);


    if(!string.isBlank(string.valueof(rowval)))   *//ERROR:Illegal arguments*
    {
        Action_Criteria__c acdelete = warpList[rowval].record;
        list<Action_Criteria__c> listAc = new list<Action_Criteria__c>();

        if(!string.isblank(acdelete.id))
        {
            Criteria_Master__c criteriaMaster = [select id,Name,Action_Criteria__c,(select id, Criteria_Master__c from Action_Criteria__r where id!=:acdelete.id ) from Criteria_Master__c where Id=:acdelete.Criteria_Master__c];
            listAc = [select id, Criteria_Master__c from Action_Criteria__c where id!=:acdelete.id and Criteria_Master__c=:acdelete.Criteria_Master__c];
            if(criteriaMaster.Action_Criteria__r.isEmpty())
            {
                criteriaMaster.Action_Criteria__c = false;
                update criteriaMaster;
            }
            delete acdelete;
        }
    }
    warpList.remove(rowval);
    system.debug('wraper List  *******'+warpList);
    return warpList;
} 
4
  • on which line you're getting an error? – Rohit Mourya Mar 27 '17 at 6:43
  • in server side.I have commented.. this line: if(!string.isBlank(string.valueof(rowval))) – Annappa Mar 27 '17 at 6:44
  • What value are you getting on this alert - alert('selIndex value :::' + Selndex);? – Santanu Halder Mar 27 '17 at 8:12
  • Share component HTML code as well. – itzmukeshy7 Mar 27 '17 at 9:56
5

This is because there is a bug with Integer attribute type that ends up not being an Integer... You need to cast it to an Integer again:

rowval = Integer.valueOf(rowval);

This is a known issue, unfortunately not exposed on the Known Issue website.

I would suggest to create a Case and ask them to add it to bug W-2544431. The more we are to report it, the more likely they are going to fix it.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.