amritbhgt
11-29-2023Cloud Apps
select All check box to select other checkboxes
Hi ,
I am trying to create a check box which will select all the other checkboxes, but somehow its not working.
if there is any other solution by using a button that would also work for me.
Thanks
{
"type": "Input.Toggle",
"title": "Select All",
"id": "chk_brand_all",
"valueOn": "true",
"valueOff": "false",
"value": "false",
"style": {
"text-align": "center"
}
},
{
"type": "Input.ChoiceSet",
"id": "chk_brand_items",
"class": "chk_brand_items",
"layout": "vertical",
"isMultiSelect": true,
"value": "",
"style": {
"padding": "4px 0 0 5px"
},
"choices": [
{
"title": "Brand",
"value": "Brand"
},
{
"title": "Brand 1",
"value": "Brand 1
},
{
"title": "Brand 2",
"value": "Brand 2"
},
$('#chk_brand_all').on('click', function(){
if(this.checked) {
$('.chk_brand_items .checkbox').each(function(){
this.checked = true;
});
}else{
$('.chk_brand_items .checkbox').each(function(){
this.checked = false;
});
}
});
In the above case, you need to assign different path to the variable 'chekboxGroup':
let chekboxGroup = args.widget.style.currentCard.body[0].items[0].columns[0].items[2];
You can find this path using browser console.
- Open the blox widget in edit mode
- Open Browser console
- Type prism.activeWidget.style.currentCard
- Open the object and find your container where checkboxes are placed
Feel free to reach out if you have further questions, we're always happy to help