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.

  • how this method is getting called? can you add that code? – Santanu Boral Apr 18 at 10:11
  • It's called by "onchange" which is inside of a lightning:select. – Alexander Atkinsoon Apr 18 at 10:50
0

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.

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.