ikSelect icon indicating copy to clipboard operation
ikSelect copied to clipboard

Sync with original select's changes

Open panych opened this issue 10 years ago • 1 comments

Hello, thanks for nice plugin.

Problem: fake and original selects don't synchronize properly when original changed programmatically. Case: change original select programmatically (E.g.: selectElement.selectedIndex = 2).

In this case ikSelect doesn't update itself. And there is no method to do this manually, something like "sync" or "refresh".

I've found a workaround, but it's haky a little bit:

$('select.mySelect').ikSelect('showDropdown').ikSelect('hideDropdown');

So it's looks like there is two options:

  1. make an auto synchronization (didn't investigate yet), or
  2. add a public method to synchronize fake and original selects.

panych avatar Sep 04 '15 12:09 panych

My previous workaround with showDropdown and hideDropdown is bad: native select could stay open on iPad2. Also it leaves focus on last select. Better way to use select method:

$('select').each(function() { $(this).ikSelect('select', this.value) });

panych avatar Nov 09 '15 14:11 panych