lundi 29 juin 2015

After setting manually, computed property do not observe changes anymore

here is jsbin http://ift.tt/1U2pOaK with input where it is possible to enter id of the item and its text will be displayed nearby. But there are two items with same "id" property and thus to display correct text they can be selected from the list on the bottom.

With "manual selection" itemId is changed only once - very first time , afterwards it's not set and subsequently "itemText" CP which observes itemId is not triggered.

The weird thing is that this effect is caused by setting value for "itemText" CP, and doesn't occur when this.setProperties({'itemId': item.id, 'itemText': item.text}); is replaced with this.setProperties('itemId', item.id); Why's that?




Aucun commentaire:

Enregistrer un commentaire