[SOLVED]How to uncheck the selected values of smart select

Hi, I’ve a popup smart select with multiple choices. I’m trying to uncheck the choices selected from the user. How can I do that?
In this way I can remove the item selected, but the choices if I open the popup still checked

 var smartSelect = app.smartSelect.get('#smart-colture');
 smartSelect.setValue('');

This is my smart select

<a class="item-link smart-select smart-select-init" data-open-in="popup"  data-searchbar="false" id="smart-colture">
										    <select name="colture" id="colture" multiple>
										      <optgroup label="Colture">
										        <option value="agrumi">Agrumi</option>
												<option value="carciofo">Carciofo</option>
												<option value="frumento">Frumento</option>
												<option value="mais">Mais</option>
												<option value="olivo">Olivo</option>
												<option value="patata">Patata</option>
												<option value="pesco">Pesco</option>
												<option value="pomodoro">Pomodoro</option>
												<option value="riso">Riso</option>
												<option value="vite">Vite</option>
										      </optgroup>
										    </select>
										    <div class="item-content">
										      <div class="item-inner">
										        <div class="item-title">Coltura</div>
										      </div>
										    </div>
										  </a>

Thank you in advance

In the docs it says that setValue requires an array if the select is multiple . Here is one way of clearing all the values, it works but I’m not sure if it’s the best way.

// Clear the select boxes
for(let i = 0; i < smartSelect.$selectEl[0].length; i++) {
    smartSelect.$selectEl[0][i].selected = false;
}
// clear the displayed values
smartSelect.setValue([]);
2 Likes

It works! thank you so much :slight_smile:

I was looking just for that thanks. Maybe it could be a hole function of smartselect component!