selectize.js
selectize.js copied to clipboard
Selectize does not work for addOption() with option value=null
I did:
- [X] Search for if my issue has already been submitted
- [X] Make sure I'm reporting something precise that needs to be fixed
- [X] Give my issue a descriptive and concise title
- [ ] Create a minimal working example on JsFiddle or Codepen (or gave a link to a demo on the Selectize docs)
- [ ] Indicate precise steps to reproduce in numbers and the result, like below
[replace me with a short description of issue]
Steps to reproduce:
Expected result: Having the possibility to add an option with value=null to be added with addOption()
Actual result: selectize does not allow to add an option with value=null with addOption().
When using selectize in html mode value=null seems to work: https://jsfiddle.net/v79613p4/
I am using Angular with ng-selectize, which uses selectize. I could identify the problem in addOption():
registerOption: function(data) {
var key = hash_key(data[this.settings.valueField]);
if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
data.$order = data.$order || ++this.order;
this.options[key] = data;
return key;
},
When typeof key === 'undefined' || key === null ||
is removed the option can be added and is visible, but now the option can not really be selected, the select dropdown box stays open. The box closes only when a 'valid' option is choosen.
I do not have experience of setting up a selectize/javascript project. I have been searching for jsfiddle/codepen examples to kickstart and narrow down the issue, haven't found any. It would be nice when the project could create some for the demos, which then can be used as a starting point.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days
The issue is about to close, can I please have your thoughts about this issue.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days