samedi 13 février 2021

Wix Code / Why doesn't the select all button select all?

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



Aucun commentaire:

Enregistrer un commentaire