Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anilsomasundaran/471b72bf3f6e302aeedd44bca4e7c7a6 to your computer and use it in GitHub Desktop.
Save anilsomasundaran/471b72bf3f6e302aeedd44bca4e7c7a6 to your computer and use it in GitHub Desktop.
({
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