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

Not nullable dataKey in DropDown break selectedOption property #1286

Closed
m1n0s opened this issue Mar 25, 2020 · 0 comments
Closed

Not nullable dataKey in DropDown break selectedOption property #1286

m1n0s opened this issue Mar 25, 2020 · 0 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@m1n0s
Copy link

m1n0s commented Mar 25, 2020

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
Next compiled code of Dropdown component doesn't work properly

key: "findOptionIndex",
    value: function findOptionIndex(value) {
      var index = -1;

      if (this.props.options) {
        for (var i = 0; i < this.props.options.length; i++) {
          var optionValue = this.getOptionValue(this.props.options[i]);

          if (value === null && optionValue == null || _ObjectUtils.default.equals(value, optionValue, this.props.dataKey)) {
            index = i;
            break;
          }
        }
      }

      return index;
    }

if value and optionValue are primitive strings and dataKey is not null which is a not rare case I think. In this scenarion selectedOption in render will be not correct.

Expected behavior
Selected option according to value prop.

The PR is ready actually. I just wanted to create issue to follow your procedures.

@mertsincan mertsincan assigned mertsincan and unassigned mertsincan Apr 1, 2020
@mertsincan mertsincan added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Apr 1, 2020
@mertsincan mertsincan added this to the 4.2.0 milestone Apr 1, 2020
@cagataycivici cagataycivici modified the milestones: 4.2.0, 4.1.3 Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

3 participants