javascript - How to have a observable collection that can be updated from two sources without causing a loop in knockout.js -
i working knockout.js. have situation have collection of items each have observable boolean isleader. 1 of them can active @ time. if people swap item in collection 1 collection check if old 1 isleader true , if set on new one. works fine. need add second input mechanism dropdown bound collection show items collection. want 1 item in collection isleader set true selected item , if selected item changed isleader updated reflect this.
how can without creating infinite loop between dropdown , collection updating selected item.
you can peek.
this.selecteditem.peek() as opposed to
this.selecteditem() as propably doing.
both return fields value, first without creating dependency. in other words, peek value, won't subscribe it.
Comments
Post a Comment