Hi amritbhgt ,
You can use the following script to add a 'Select All' checkbox in Blox:
Blox:
{
"style": "",
"script": "",
"title": "",
"showCarousel": true,
"body": [
{
"type": "Input.Toggle",
"title": "Select All",
"id": "chk_brand_all",
"style": {
"text-align": "center"
}
},
{
"type": "Input.ChoiceSet",
"id": "chk_brand_items",
"class": "chk_brand_items",
"layout": "vertical",
"isMultiSelect": true,
"value": "Brand,Brand 1,Brand 2",
"style": {
"padding": "4px 0 0 5px"
},
"choices": [
{
"title": "Brand",
"value": "Brand"
},
{
"title": "Brand 1",
"value": "Brand 1"
},
{
"title": "Brand 2",
"value": "Brand 2"
}
]
}
],
"actions": []
}
Widget Script:
widget.on('ready', (sender, args) => {
let chekboxGroup = args.widget.style.currentCard.body[1];
if(chekboxGroup.choices.map(item => item.value).join(',') === chekboxGroup.value){
$('#chk_brand_all')[0].checked = true;
} else {
$('#chk_brand_all')[0].checked = false;
}
$('#chk_brand_all').click(function(){
if(this.checked) {
let allValues = chekboxGroup.choices.map(item => item.value).join(',')
chekboxGroup.value = allValues;
} else {
chekboxGroup.value = '';
}
args.widget.redraw();
})
});
You also have the alternative of utilizing the Pladi Advanced Filter plugin. With this plugin, you can incorporate multiple dropdown filters into a single widget and configure each dropdown for single or multiple selections. The plugin offers a diverse range of customization options to tailor the filters according to your needs.
Feel free to reach out if you have further questions, we're always happy to help 🙂
[email protected]
Paldi Solutions