I have used Check all / Un checkUncheck 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>
"Uncaught Error in $A.getCallback() [Cannot read property 'set' of undefined]"
I used <ui:inputCheckbox>
Error in codeCode:
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*isvalid__C
is field name
This Similar code is working proper for more than 1 rows but not for one row. Please suggest me some ideas to make checkbox checked by default in lighting using javascript.