I have select all and remove all buttons for check boxes. You can see the code below. But the error is that he should select all of them (not all the options in the check boxes.) Why doesn’t the check box select all the options? what is the lack
Detail https://www.wix.com/velo/forum/community-discussion/why-doesn-t-the-select-all-button-select-all [![enter image description here][1]][1]
My Code
export function CountrySelectAllt_click(event) { // number of items in checkbox group let totalItems = $w('#checkboxt1'+ ", " +'#checkboxt2'+ ", " +'#checkboxt3'+ ", " +'#checkboxt4').options.length; // initiate a newIndices array to hold all indices let newIndices = []; for (var i = 0; i < totalItems; i++) { newIndices.push(i); } console.log(newIndices); $w('#checkboxt1').selectedIndices = newIndices; $w('#checkboxt2').selectedIndices = newIndices; $w('#checkboxt3').selectedIndices = newIndices; $w('#checkboxt4').selectedIndices = newIndices; } export function CountrySelectAlltreset_click(event) { // number of items in checkbox group let totalItems = $w('#checkboxt1'+ ", " +'#checkboxt2'+ ", " +'#checkboxt3'+ ", " +'#checkboxt4').options.length; // initiate a newIndices array to hold all indices let newIndices = []; for (var i = 0; i < totalItems; i++) { newIndices.push(i); } console.log(newIndices); $w('#checkboxt1').selectedIndices = []; $w('#checkboxt2').selectedIndices = []; $w('#checkboxt3').selectedIndices = []; $w('#checkboxt4').selectedIndices = []; } [1]: https://i.stack.imgur.com/mQBT8.jpg
Advertisement
Answer
Solution !
” Wix code SDK error: The value of selectedIndices parameter that is passed to the selectedIndices method cannot be set to the value “2”. It must be between 0 and 1. “
The strange thing (I think) is the rule of having equal number of boxes in the control boxes.
For the solution, the number of boxes in your control boxes should be equal. If a single box is sufficient as a design, a single control box, but if it is not sufficient or not suitable for your design, there should be an equal number of controls for many control boxes.