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

Data-binding does not work in selected item #128

Closed
4 tasks done
tomalec opened this issue Jun 7, 2018 · 3 comments
Closed
4 tasks done

Data-binding does not work in selected item #128

tomalec opened this issue Jun 7, 2018 · 3 comments
Assignees

Comments

@tomalec
Copy link
Contributor

tomalec commented Jun 7, 2018

Description

Data binding is broken when the option is selected. It updates values on the list, but not in the selection.

Live Demo

https://jsbin.com/rafumiv/2/edit?html,output

Steps to Reproduce

  1. Create a fragment with
    • vaadin-dropdown-menu, with Polymer's binding (<vaadin-item>{{item}}</vaadin-item>) inside it,
    • bound an input element to the same value , with Polymer's binding (<input value="{{item}}">),
  2. Append this fragment to a dom-bind or any Polymer element,
  3. Pick the option.
  4. Change the value

Expected Results

Value is updated in the dropdown

Actual Results

There is still the old value.

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • [?] Safari 9
  • [?] Safari 8
  • IE 11

Versions

@platosha
Copy link
Contributor

platosha commented Jun 7, 2018

The reason is: the displayed value is a DOM clone of an actual item from the template instance.

Possible solution: intercept forwardHostProp invocation on the template instance and update the displayed clone.

const origForwardHostProp = dropdownMenu._overlayElement._instance.forwardHostProp;
dropdownMenu._overlayElement._instance.forwardHostProp = function() { 
  origForwardHostProp.apply(this, arguments);
  setTimeout(() => dropdownMenu._updateValueSlot());
};

@tomalec
Copy link
Contributor Author

tomalec commented Jun 7, 2018

Are you suggesting it as a solution on a user level, or as something to be done by vaadin-dropdown-menu?

If it's a solution for user-land, then it's quite risky to rely on internal (_*) API to hack things around.

@platosha
Copy link
Contributor

platosha commented Jun 7, 2018

Something for the <vaadin-dropdown-menu>, of course.

@yuriy-fix yuriy-fix added needs triage Has to be triaged by the team in progress and removed needs triage Has to be triaged by the team labels Jun 20, 2018
@yuriy-fix yuriy-fix self-assigned this Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants