knockout.js - Resetting dropdown by manual subscription doesn't work depending on what observable was subscribed to -
I searched online and tried to understand this behavior and work hard but I just could not find out that this behavior Why is it possible that I am missing something fundamental here?
I would appreciate some hints / resources / answers.
Consider this Bela -
Why it Resets Product Selection
// Whenever the category changes, the product selection Reset self.category.subscribe (function () {self.productName (undefined);}); While this is not it?
// Whenever the category changes, reset product selections self.categoryName.subscribe (function () {self.productName (undefined);});
It must be done from the order in which the subscribe event The other is called relative to the computed properties computed and subscribe properties of D are said in the same order when they were viewed There is a change on the property. Here's what is happening in each case, this is the best thing, as I can tell (Kendo has not read the source, so there is some guess):
category.subscribe: > Code due to change in Note: Change the calculation value of Note: catego RyName.subscribe: Note: Due to the change in Complete all dependent-computed properties and membership events I tested the category productName is still the old value at this point category. ProductName product the event is converted the property calculated due to the change in Product Name productName is undefined now c productName and the product list undefined >
categoryName < category name view is updated due to change in / code> category category productName the product still has the old value at this point category Has been updated, so updated on the basis of kendoDropDownList new products list and the current ( of productName undefined ) value candodeupdownlist Ode> and it chooses the first option even if you have productName Dummy string such as 'asdf' is set to. It shows only empty if the value is empty string ( '' ) or undefined .
productName Note: productName is Undefined now
class does not update it again because it Products are not dependent on or productName , but should update Candodeupdualist
optionLabel in kendoDropDownList , then it will work as expected, even then. If you enter categoryName.subscribe before, category = ko.computed (...) First, then the whole cycle begins before productName to undefined which will be a way to fix it. Here is a Bella:
Another way is to describe the optionLabel parameter as KandodaproductionList option hash as described in step 8. >
Comments
Post a Comment