Closed sousekd closed 6 years ago
Hi,
We are still struggling with the issue. I believe that having a set of dropdowns for editing hierarchical data on a form has to be quite a common scenario - so maybe we are just doing something completely wrong... Until this is fixed, does anybody know about some elegant workaround?
Thanks again, David
@jdanyow Can you provide some insight?
Ok, the workaround is actually pretty straightforward:
change.delegate="onParentChange()"
onParentChange() { this.selectedChild = null; }
But I still think this should be unnecessary...
similar to https://github.com/aurelia/binding/issues/521 has to do with the value the child select is bound to changing prior to the child select's options being updated by the repeat. We may need to put a mutation observer on the select to ensure we can synchronize the selected value after the options change.
Indeed it's similar to https://github.com/aurelia/binding/issues/521
one could be closed
Closing as duplicate.
@sousekd fix for this is at https://github.com/aurelia/binding/pull/677
Hi,
I'd like to submit a bug report
Please tell us about your environment:
Operating System: Windows 10
Browser: Chrome 56.0.2924.87
Language: all
Current behavior:
We are having issues when trying to bind two selects (dropdowns) in a typical parent/child scenario, The child dropdown (which is bound to selected parent's children) is not rebound correctly after change of the parent when there is too few items. See this Gist demo to reproduce the issue. You can see there 2 exactly same bindings that differ in number of items only, and one binding with
<template>
workaround, which solves the issue only partially:Long hierarchy (working great):
Short hierarchy (not working):
Short hierarchy (with template workaround):
As you can see, the change of selected Parent to both another item or null on the first pair causes the reset of selected Child item. On the second pair, the selected Child item is not reset when another Parent item is selected, but it is reset when null Parent is selected. On the third pair, the selected Child item is reset when another Parent item is selected, but it is not reset when null Parent is selected.
The point is that the first two dropdown pairs are 100% identical, only the amount of data differs. The correctly working (first) one operates on a larger hierarchy, the incorectly working (second) one operates on a smaller set. The third pair of dropdowns is our attempt to workaround the issue by enclosing the child dropdown within
<template with="selectedParent">
tag.Expected/desired behavior:
What is the expected behavior? Most importantly, we would expect all three pairs to work consistently, not being affected by the size of an array they bound to. I think the first pair in the Gist demo works best.
What is the motivation / use case for changing the behavior? In our applications, we have many dropdowns bound to lists of items which change during screen lifecycle, and it causes us problems when dropdowns go out-of-sync and we have different data in viewmodels and different on a screen.
Thank you very much for looking at this. We love Aurelia and this is one of very few issues we've faced in almost one year of otherwise fantastic experience.
Best Regards, David