pbauerochse / searchable-option-list

a jquery plugin for a searchable optionlist
MIT License
79 stars 54 forks source link

Select options/items programmatically[Feature request] #49

Open wentzwu opened 7 years ago

wentzwu commented 7 years ago

SOL is working really well. I would suggest SOL provide "Select" method for programmers to select options/items programmatically and SOL automatically updates the UI, the "quickDelete" buttons specifically.

akshithrajesh290 commented 6 years ago

Have you achieved this by selecting the items programmatically ? @wentzwu

I tried the below method but Delete option is firing Do I need to add any click events for it

Could you anyone please let me know how can I select Options after binding the list items

I can Select the items but however I couldn't Delete the Items (i.e On (x) Click is not firing

I added the items to the sol-current-selection class using jquery and Selected the Checkbox using below code ::

$(":checkbox[value=4]").prop("checked","true");

<div class="sol-current-selection">
<div class="sol-selected-display-item">
<span class="sol-quick-delete">×</span>
<span class="sol-selected-display-item-text">Option1</span>
</div>
<div class="sol-selected-display-item">
<span class="sol-quick-delete">×</span>
<span class="sol-selected-display-item-text">
Option 2</span></div>
</div>