Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editable Dropdown content does not reflect input value #408

Closed
drabikowy opened this issue May 11, 2018 · 4 comments
Closed

Editable Dropdown content does not reflect input value #408

drabikowy opened this issue May 11, 2018 · 4 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@drabikowy
Copy link

drabikowy commented May 11, 2018

I'm submitting a ... (check one with "x")

[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Current behavior
Editable dropdown content does not reflect the value of the input

Expected behavior
Editable dropdown text should reflect input value

Minimal reproduction of the problem with instructions
I created regular controlled input using Dropdown component with editable option enabled
Dropdown value depends on container state and it gets updated onChange.
I noticed a problem, when I added filtering to the dropdown value before setting container state (i filtered characters other than numbers).
Then, when I type in editable dropdown some numbers and letters i can still see all text, while the value property of input is already filtered and shows only numbers as expected.
It seems like the text content of dropdown is not bind to it's value.
Tested with sample component:

import React, { Component } from 'react'
import { Dropdown } from 'primereact/components/dropdown/Dropdown'

export default class TestDropdown extends Component {
  constructor (props) {
    super(props)

    this.state = {
      dropdownValue: ''
    }
  }

  render () {
    return (
      <Dropdown
        editable
        options={[
          { label: 'option1', value: 'option1' },
          { label: 'option2', value: 'option2' }
        ]}
        value={this.state.dropdownValue}
        onChange={(e) => {this.setState({dropdownValue: 'test-value'})}}
        placeholder='Select...' />
    )
  }
}

On every input change - value of the input is being updated to 'test-value', but text visible in input is whatever you type in.

  • React version:
    16.2.0

  • PrimeReact version:
    1.5.1

  • Browser:
    All

drabikowy pushed a commit to drabikowy/primereact that referenced this issue May 11, 2018
drabikowy pushed a commit to drabikowy/primereact that referenced this issue May 11, 2018
@drabikowy
Copy link
Author

I thought that changing defaultValue to value on editable dropdown input will help, but then there are errors regarding controlled / uncontrolled input. So no quick solution so far. Please take a look on that issue

@mertsincan
Copy link
Member

Could you please try PrimeReact 1.5.2 version for this issue?

@drabikowy
Copy link
Author

Hello, @mertsincan.
I've just checked. The issue is still valid for 1.5.2.

@mertsincan mertsincan self-assigned this May 24, 2018
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label May 24, 2018
@mertsincan mertsincan added this to the 1.6.0 milestone May 24, 2018
@mertsincan
Copy link
Member

Fixed for next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants