Multiselect not working
See original GitHub issue@JedWatson I am trying to implement a multi-select dropdown in my app using react-select. The problem what I am facing is when I add the multi={true}
flag, the values are not being selected from the options in the dropdown list.
It has the same problem in one of your examples on the website, the numeric-values example with multi-select enabled.
I am attaching the code for my dropdown here, please tell me if I am going wrong anywhere:
Dropdown.jsx
import React, { Component, PropTypes } from 'react';
import styles from './styles/dropdown.css';
import config from './styles/config.css';
import Select from 'react-select';
import compose from 'lodash.compose';
import { makeHorizontalComponent, makeVerticalComponent } from './utils';
import cssModules from 'react-css-modules';
@cssModules({ ...styles, ...config })
class Dropdown extends Component {
static defaultProps = {
orientation: 'horizontal'
}
constructor(props) {
super(props);
}
render() {
const { onBlur, label, multiple,
upload, description,
options, className,
labelKey, valueKey,
orientation, popup,
input: { onChange, value, onBlur: reduxOnBlur, name }
} = this.props;
const composedOnBlur = compose(reduxOnBlur, onBlur ? onBlur : f => f);
<Select multi simpleValue value={value} clearable={false} options={options} labelKey={labelKey} valueKey={valueKey} placeholder="Select the days"onBlur={() => composedOnBlur(value, name)} onChange={ (object) => onChange(object[valueKey] || object.value) } />
and I am using this Dropdown component as follows:
const days = [
{id: 1, label: 'Sun'},
{id: 2, label: 'Mon'},
{id: 3, label: 'Tue'},
{id: 4, label: 'Wed'},
{id: 5, label: 'Thu'},
{id: 6, label: 'Fri'},
{id: 7, label: 'Sat'},
];
<Field component={Dropdown}
label="Days"
popup={true}
options={days}
multiple={true}
valueKey="id"
labelKey="label"
name="autoDial.workingDays"
className="row-popup"
description="System Management is privilege can allow anyone to alter lorem ispum"
/>
When i try to select a value from the dropdown, it doesn’t even get selected.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:12
Top Results From Across the Web
Bootstrap Multiselect not working - Stack Overflow
I'm trying to use multiselect Bootstrap, I used the following code which is also available in their website too at (http://davidstutz.github.io/bootstrap- ...
Read more >Bootstrap multiselect dropdown not opening in Bootstrap v5
This problem occurs since bs5 has changed all bootstrap "data-" attributes to "data-bs-". You can fix this directly in the js (also in...
Read more >Checkbox multi-select not working - Laracasts
I'm using the Bootstrap plug-in to do the checkbox multi-select, but for some reason I'm not getting the multi check-boxes. Any ideas as...
Read more >Multiselect not working for jquery/bootstrap
Expected behaviorhttps://mdbootstrap.com/docs/jquery/forms/multiselect/#basic-exampleActual behavior*it only displays options on screen.
Read more >Bootstrap multiselect not working - MSDN
I am trying to use a dropdownlist with checkboxes instead of a multiselect list (default for <select multiple="multiple">).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ugh - so to sum up, and to hopefully help out whoever shows up here from Google, you need to manually manage the value to the
Select
component - pass in the array of selected values, and add to it inonChange
@digitalmio @KevinBrolly it works for me now, It was my mistake earlier. This is the code which I used and it works perfectly fine for me.
@JedWatson sorry for opening this issue. It was my mistake earlier. Closing this issue.