Comments (5)
Hi Nguyễn, I'm having troubles understanding what the problem is that you're describing. Can you be more detailed about the expected behavior? Also, if you have a code example, that would also be helpful.
from selectize.js.
I have a single select element, when user change value of the select, the value of the select will post to server via ajax.
So the value will post only one time when user select an option. It work as design.
Then i apply selecize js to the select element. When user select an option in dropdown menu(".selectize-dropdown .div") the original select is triggered change event 2 times.
- (1) First, the funtion clear() is call and change event in triggered for the select
The workflow: Selectize.prototype.onOptionSelect >> Selectize.prototype.addItem >> Selectize.prototype.clear >> Selectize.prototype.updateOriginalInput >> this.$input.trigger('change'); - (2) Second, you add item to the select and call updateOriginalInput(), in function updateOriginalInput() you trigger the change event again.
The workflow:Selectize.prototype.onOptionSelect >> Selectize.prototype.addItem >> Selectize.prototype.updateOriginalInput >> this.$input.trigger('change');
The expected behavior is the change event is not triggered when you clear the select before adding item item it.
I want the change event is triggered only one time - when item is added to select (2) but not in clearing the select (1)
from selectize.js.
Got it! Thanks for the detailed walkthrough—I understand the problem now. I'll try to an issue a patch for it very soon.
(p.s. updated the issue title)
from selectize.js.
Thanks, you understood my idea. Of course, the title should be changed.
from selectize.js.
I cloned lastest version and the "change" event still being triggered twice as scenario from issue
#11 (comment)
Here is call stack from Chrome Debugger
from selectize.js.
Related Issues (20)
- Searching with underscore doesn't work correctly HOT 1
- Incorrect role is being assigned to combo box; it is impacting accessibility of the control. HOT 2
- remove_button uses a hardcoded 2px border radius HOT 1
- Can't add items to a (multi) select after updating inputs (in order) HOT 1
- Couldn't find the way to use a custom plugin without adding it to the Selectize fork HOT 1
- remove_button plugin bug: append expects html_container to be a string HOT 1
- Documentation for `selectOnTab`'s default is out of date HOT 2
- Unable to load options when triggering load for the second time HOT 1
- Quotation marks in selected option value result in error when selecting another value HOT 2
- Cursor disappears after selecting option in select multiple when using CDN provided version HOT 6
- jQuery deprecation warning: .trim() HOT 1
- Wrong autocompleate type
- Add link to Selectize options list in API documentation of Selectize()
- selectize.destroy and 'blur' event on other selectized objectects
- Selectize with Laravel full text search not working HOT 1
- Hovered option is automatically selected on blur HOT 3
- Cannot be able to retrieve data attribute when selectize is rendering
- converting from boostrap-select: encountering several issues...
- Incorrect role is being assigned to combo box; it is impacting accessibility of the control. HOT 1
- Loosing focus on the field if addItems method is used
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from selectize.js.