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? Commented Mar 27, 2017 at 6:43
  • in server side.I have commented.. this line: if(!string.isBlank(string.valueof(rowval)))
    – Annappa PH
    Commented Mar 27, 2017 at 6:44
  • What value are you getting on this alert - alert('selIndex value :::' + Selndex);? Commented Mar 27, 2017 at 8:12
  • Share component HTML code as well. Commented Mar 27, 2017 at 9:56

1 Answer 1

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
  • Ya Fabien you are right...Thanks ....:) better we have to report this bug..
    – Annappa PH
    Commented Mar 27, 2017 at 14:49
  • I recently had to do the same fix for Longs (theLong = Long.valueOf(theLong + '');). Fun times. Raised support case 16524930 to try and get a known issue to track it. Commented May 19, 2017 at 0:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .