Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.

Conversation

@radireddy
Copy link
Contributor

support nested property like "region.name" on match input in oui-select component

Closes #MANAGER-2056

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Title of the Pull Requests

support nested property like "region.name" on match input in oui-select component

Description of the Change

oui-select-picker uses oui-select. This issue happens If match property has nested properties like 'region.name.' The reason is that of a bug in match.html used by oui-select. It does not take the nested property into consideration.

 <span class="ui-select-match-text"
            ng-hide="$select.isEmpty()"
            ng-bind-html="$select.selected[$ctrl.match] || $select.selected">
  </span>

in the above code, we straight away getting a property on the object. But the supplied property is a nested property.

Solution: used loadash get that supports nested property.

Benefits

Possible Drawbacks

none

Applicable Issues

MANAGER-2056

support nested property like "region.name" on match input in oui-select component

Closes #MANAGER-2056
<span class="ui-select-match-text"
ng-hide="$select.isEmpty()"
ng-bind-html="$select.selected[$ctrl.match] || $select.selected">
ng-bind-html="$ctrl.getPropertyValue($select.selected) || $select.selected">
Copy link
Contributor

@AxelPeter AxelPeter Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radireddy Since getPropertyValue can return a default value with get, maybe we should go with;

ng-bind-html="$ctrl.getPropertyValue($select.selected)"

and

    getPropertyValue (item) {
        return get(item, this.match, item);
    }

What do you think ?

@AxelPeter AxelPeter merged commit 6c87d73 into master Jan 8, 2019
@AxelPeter AxelPeter deleted the nested-property-support branch January 8, 2019 09:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

5 participants