I have used Check all / Uncheck All checkboxes function to select group of Values. I used to display some data in aura iteration with checkbox values checked.
If the data row is more than one its working fine suppose if the row count is one im facing error:
"Uncaught Error in $A.getCallback() [Cannot read property 'set' of undefined]"
I used <ui:inputCheckbox>
Code:
component.find("checkBox")[i].set("v.value", true);
var recordfinallist = component.get('v.attributename');
for (var i = 0; i < recordfinallist.length; i++) {
if (recordfinallist [i].isvalid__C== true){
component.find("checkBox")[i].set("v.value", true);
}
}
}
*isvalid__C
is field name
This code is working proper for more than 1 rows but not for one row.