0

Hi I am trying to edit a specific row in an iteration based on an onchange event.

One of my columns in my iteration is a picklist. And depending on what is selected I want the rest of the columns in the row to become enabled and autopopulated.

I know how to get the index of what triggered the onchange with the below code.

checkRow : function(cmp, event,helper) {
  var target = event.target;
  var dataEle = target.getAttribute("data-selected-Index");

/*get and edit columns where iteration index = dataEle

}

But how do I then edit that index of the iteration to enable the input fields and autofill them?

I hope this makes sense.

2
  • how this method is getting called? can you add that code? Apr 18, 2019 at 10:11
  • It's called by "onchange" which is inside of a lightning:select. Apr 18, 2019 at 10:50

1 Answer 1

1

Solved the issue with the following javascript:

checkRow : function(component, event,helper){

    var target = event.getSource();
    var rowIndex = target.get('v.title');
    var list = component.get('v.Items');

    console.log('Row Index: ' + rowIndex);
    console.log(list[rowIndex]);

    list[rowIndex].Quantity__c = 'Override';
    list[rowIndex].newElement = 'test';

    component.set('v.Items', list);


}

v.Items is a an attribute of type object[] which is used by my iteration.

You must log in to answer this question.

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