Comments (3)
I think this is the same issue but has no answers: #1117
from react-widgets.
That's not how a drop-down works generally, the text inputs is just for filtering it's not the "value" of the drop-down. The filter input is empty when you focus the input. If you want to control what the starting search term is you can control and provide the searchTerm
prop
from react-widgets.
Thanks, that is what I was looking for. A little bit of state management and I've been able to accomplish what I needed.
For those in the same situation, What I've done is maintain the searchTerm in a state variable, and update it on onSearch. Also added a useEffect when the DropdownList is open to establish again the filter, as when the DropdownList closes it sets the filter to empty string.
// defaultFilter is a variable with the filter I want to be shown on open.
// When a value is selected in the dropdown I update defaultFilter to the new value, so on open, the new value is used as filter
const [filter, setFilter] = useState(defaultFilter);
const [isOpen, setIsOpen] = useState(false);
useEffect(() => {
if (isOpen) {
setFilter(defaultFilter);
}
}, [isOpen]);
return (
<DropdownList
onSearch={ search => { setFilter(search); } }
searchTerm={ isOpen ? filter : '' }
onToggle={ isOpen => setIsOpen(isOpen) }
....
/>
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
- 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.