Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
({
doInit : function(component, event, helper) {
//user information
var userData = [{"id":1, "name":"Anil", "city":"Ernakulam", "country":"India"},
{"id":2, "name":"Akhil", "city":"Palakkad", "country":"India"},
{"id":3, "name":"Raju", "city":"Wayanad", "country":"India"},
{"id":4, "name":"Mahesh", "city":"Kannur", "country":"India"}
];
component.set("v.data",userData);
},
onCheckboxChange : function(component, event, helper) {
//Gets the checkbox group based on the checkbox id
var availableCheckboxes = component.find('rowSelectionCheckboxId');
var resetCheckboxValue = false;
if (Array.isArray(availableCheckboxes)) {
//If more than one checkbox available then individually resets each checkbox
availableCheckboxes.forEach(function(checkbox) {
checkbox.set('v.value', resetCheckboxValue);
});
} else {
//if only one checkbox available then it will be unchecked
availableCheckboxes.set('v.value', resetCheckboxValue);
}
//mark the current checkbox selection as checked
event.getSource().set("v.value",true);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.