brianvoe / slim-select

Slim advanced select dropdown
http://slimselectjs.com
MIT License
1.03k stars 195 forks source link

setSelected without triggering afterchange #480

Closed Tobfather closed 9 months ago

Tobfather commented 1 year ago

I have the following situation. I need to sync multiple selects on one site. If one changes I'd like to update the others with calling setSelected on them but it triggers their afterChange and I don't want that.

I know you changed it that way, following this issue: https://github.com/brianvoe/slim-select/issues/367

My suggestion: add a param to setSelected to select if afterChange should be triggered or not.

If there's another way to keep multiple selects in sync I'd be happy to hear about!

brianvoe commented 9 months ago

Its not documented but setSelected takes in a second param

public setSelected(value: string | string[], runAfterChange = true): void {
}

Im going to add it to docs in the next release

Thanks for pointed it out as I did need it in the development of the package

Consider donating please