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

Dropdown options does not update when props is changed #108

Closed
hkraymondhk opened this issue Sep 21, 2017 · 1 comment
Closed

Dropdown options does not update when props is changed #108

hkraymondhk opened this issue Sep 21, 2017 · 1 comment
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@hkraymondhk
Copy link

The option list for the dropdown component is not updated accordingly when the props.options is updated. And the filter result would be carried to new filtered option list even those options are no longer available in the new option list.

Here is my temporary fix/workaround by updating the following block of codes for your reference.

key: 'componentWillReceiveProps',
        value: function componentWillReceiveProps(nextProps) {
            if (!_ObjectUtils2.default.equals(nextProps.options, this.props.options)) {
                this.optionsToDisplay = nextProps.options;
                this.setState({ optionsToDisplay: this.optionsToDisplay });
                this.optionsChanged = true;

                this.updateSelectedOption(this.value);
                if (this.filterValue && this.filterValue.length) {
                    this.activateFilter(nextProps.options);
                }else {
                    this.updateOptions();
                }
            }
        }
key: 'activateFilter',
        value: function activateFilter(options = this.props.options) {
            var searchFields = this.props.filterBy.split(',');
            if (options && options.length) {
                this.optionsToDisplay = _ObjectUtils2.default.filter(options, searchFields, this.filterValue);
                this.setState({ optionsToDisplay: this.optionsToDisplay });
                this.optionsChanged = true;
                this.updateOptions();
            }
        }

@cagataycivici cagataycivici self-assigned this Sep 21, 2017
@cagataycivici cagataycivici added the Type: Bug Issue contains a defect related to a specific component. label Sep 21, 2017
@cagataycivici cagataycivici added this to the 1.0.1 milestone Sep 21, 2017
@cagataycivici
Copy link
Member

I've just finished reimplementing the Dropdown and this issue should be resolved now as well.

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