searchable-option-list icon indicating copy to clipboard operation
searchable-option-list copied to clipboard

How can Dynamically updates options

Open kapilgp opened this issue 9 years ago • 3 comments
trafficstars

Hi,

Is there any option to update the list of options. I mean we have to update the options dynamically. if not then how we can destroy and re-initialize?

kapilgp avatar Nov 06 '16 09:11 kapilgp

Did you make any progress on this ?

Novakinify avatar Feb 27 '17 18:02 Novakinify

Yes, I have apply a hack in plugin for it:

Go to plugin line 1052

if ($alreadyInitializedSol) { result.push($alreadyInitializedSol);

And Replace it by: if ($alreadyInitializedSol) { //result.push($alreadyInitializedSol); $alreadyInitializedSol.$container.html(''); var newSol = new SearchableOptionList($this, options); result.push(newSol); setTimeout(function () { newSol.init(); }, 0);

After than you just need to update options in select box And re-bind searchOptionList like:

$('#test').searchableOptionList({ maxHeight: '180px', showSelectAll: true })

kapilgp avatar Feb 27 '17 19:02 kapilgp

Great, thanks man, it works like this :D You saved my time...

Novakinify avatar Feb 27 '17 22:02 Novakinify