You need to sign in to do that
Don't have an account?
Mallikarjuna Reddy 19
How to check all the checkboxes in a lightning:checkboxGroup component dynamically whlie loading the Page?
1.I create lightning:checkboxGroup component. options and value are comming from server controller.
2.i set the options in controller. options are loaded and checkboxes are showing.
3.i set the value in the controller.but checkboxes are not checked dynamically.
can you please help me?
2.i set the options in controller. options are loaded and checkboxes are showing.
3.i set the value in the controller.but checkboxes are not checked dynamically.
can you please help me?
May I suggest you please refer the below link for reference.
- http://www.sfdcmonkey.com/2017/02/23/delete-multiple-records-using-checkbox-lightning-component/
- https://www.lightningdesignsystem.com/components/checkbox/
Let us know if it helps.Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar
I got this problem myself yesterday, und just figured out a solution, as following:
In JavaScript Controller
In your .cmp
In the attribute name you set the default from the same list you got in js
NOTE !! its's very important that the listOfItems has the same values as those you use in options in checkboxGroup,
else it just won't work!!
In checkboxGroup the attribute value has a feld of values which will be checked as a default!
For more Info:
I created an attribute: and a method:
I also struggled to set the options in apex but finally cracked it by converting the JSon strings to javascript objects:
Here's how your apex method might look. I'm getting a list of all the teams (collaboration groups). Note I've added a "select all" option.
using controller methods:
Sorry this is two years later but hope it helps someone. Please mark as best answer.