Tuesday, January 17, 2017

Angular2 issues with Vaadin Combo box. Using [ngModel] and (selected-item-changed) to set selected id value. not using [(ngModel)] selected-item-changed fires 3 times: 1) with 1st item in list - no matter what selection 2) same value as first 3) null value result: no selection is made. findings: item-value-path has wrong path. selected-item-changed fires 2 times: 1) with correctly selected value 2) null value result: no selection is made. findings: selected-item-changed handler was (re)setting the selected value to an invalid property, resulting in value being null a.selected-item-changed fires 2 times: 1.a) with correctly selected value 2.a) with 1st item in list result: wrong selection is made. b.selected-item-changed fires 2 times: 1.b) with previous selection 2.b) with correct value result: correct selection is made. c.selected-item-changed fires 1 time: 1.c) with correct value findings: item-value-path was using a key that could be null for selected item. selected-item-changed handler was (re)setting the selected value to correct value again, resulting in second change event firing. If key was valid and unique, selection was made correctly.

No comments: