Tradeshift / tradeshift-ui

Tradeshift UI is a framework-agnostic JavaScript library to help Tradeshift App developers to create cohesive user experiences and to provide reusable UI components.
https://ui.tradeshift.com
Other
33 stars 44 forks source link

Cannot clear selected values of selector component #56

Closed DocGroth closed 7 years ago

DocGroth commented 7 years ago

Problem description: We can't make the values of "TS selector multiple" checked/unchecked from jQuery.

The above is a sample code. There are 2 values "value1" and "value2". We're going to change the value1 from unchecked to checked. But this does NOT make option (id=“value1”) checked.

I also attached the movie to show the above problem.

Expected description: The values on multiple selector must be checked/unchecked from JS.

Steps to reproduce: Use "select multiple" http://tradeshift.github.io/Client-Docs/app/#/docs/components/forms/

Sample Code: in HTML

<fieldset> 
<label> 
   <span>A Choose</span> 
   <select multiple id=“myId”> 
       <option value=“value1” class=“chooser” id=“value1”>Value 1</option> 
       <option value=“value2” class=“chooser” id=“value2”>Value 2</option> 
   </select> 
</label> 
</fieldset> 

in jQuery script

var selection = get_selection_from_object; 
. . . 
. . . 
if(selection == “value1”) { 
   $(“#value1”).prop(“checked”, true); 
} 
wiredearp commented 7 years ago

The correct property name is selected and not checked (and has been confirmed to work as intended when you toggle the correct property).