Created
May 5, 2018 20:12
-
-
Save anilsomasundaran/471b72bf3f6e302aeedd44bca4e7c7a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
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