reactjs - Select2 mulit-select with redux-form -




i using select2 in react. following in code component:

<select classname='form-control select-2-currency select2' {...input} value={[input.value]} onblur={ () => input.onblur(input.value) } multiple> {  options.map((option, index) =>   <option key={index} value={option.id}>{option.country}</option> )} </select> 

my componentdidmount() component is

componentdidmount() {     $('.select-2-currency').select2({})       .on('select2:select', () => {         console.log("value", $('.select-2-currency').val())         this.props.input.onchange($('.select-2-currency').val());       })       .on('select2:unselect', () => {         console.log("value ewdfefg", $('.select-2-currency').val());         this.props.input.onchange($('.select-2-currency').val());       })   } 

following how passing props component

    <field     name='currency_id'     component={selectobject}     label='currencies'     options={currencies}     field='currency_id'    /> 

when try values in redux-form, gives problem. example, if options has 10 data points, able enter 2 points. moment enter 3rd one, select gets reset , previous 2 values removed , updated 3rd one. repeats every time enter 3rd value in select. not able enter more 2 values in select.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -