Comments (4)
I have gone back and forth on splitting the callbacks. I may add a keyDown, or press or something in the future to capture typing. One issue is that it is hard to tell when a user is "done" typing, We should probably add an onSelect
handler for when the value is selected from a list vs typing something...
In the meantime, you can effectively achieve what you are looking for in your onChange
handler. The terms "intermediate" and "final" are a bit misleading, because all typed values in a combobox are valid as "final" values; i.e. you can select values that are not in the data
list.
If your data
prop is an array of objects { id: 0: name "james" }
you can just check whether the onChange
handler returned a string or an object. the instance of the value object will be returned when it is a value in the list.
function onChange(value){
if ( typeof value === 'string' ) //value is not in the list
}
If your data
array is an Array of strings, than you can just check whether the value is in the data list. You can also use this method for the above case as well.
function onChange(value){
if ( data.indexOf(value) === -1 ) //value is not in the list
}
from react-widgets.
the more I think about this I am also convinced that there should be a onSelect
handler for dropdowns and comboboxes...I may see if I can get to that this weekend
from react-widgets.
Thanks for the response @jquense.
Using an if statement to detect a match is the way I'm doing it currently. But I see two problems with this approach:
a) It may produce a false match. e.g. A list containing "Apple" and "Apple Pie".
b) The Combobox widget still stays open at this point.
An onSelect
handler would be awesome.
from react-widgets.
Thank you @jquense.
from react-widgets.
Related Issues (20)
- ComboBox autoFocus not working
- DateTimePicker Cutting in Container make over-flow-x
- feature: change caret to X on combobox
- Multiselect defaultValue doesn't refresh when props value changes HOT 1
- Combobox has unexpected behavior when using hideEmptyPopup
- findDOMNode is deprecated in StrictMode - error HOT 7
- Error finding scss files.
- Calendar: Add option to display week numbers
- Add tailwind 3 support
- Add !default to $max-height in popup.scss
- Deprecation warning with `sass 1.62.0` HOT 2
- Custom tagListComponent HOT 1
- Unable to set tabindex on footer of calendar widget
- How to stablish the value on open DropdownList HOT 3
- Achieved
- Tailwind: [WARNING] "zindex" is not a known CSS property [unsupported-css-property] HOT 1
- Multiselect - Sort tags and options alphabetically HOT 1
- DatePicker monthFormat in version 5
- Virtualized MultiSelect
- Can not set DatePicker input id via inputProps
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 react-widgets.