This is a migrated thread and some comments may be shown as answers.

MVVM: Dependent Property Can't use value of another Dependent Property

1 Answer 103 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 15 May 2012, 03:43 PM
It seems that in the current implementation of MVVM:

  • A dependent property (calculated field) can easily use the value of another property of the view Model through the this.get(propertyName) syntax.
  • However, a new calculated field can't seem to utilize another property of the view Model IF THAT PROPERTY is ITSELF a Calculated Field.
Can someone confirm this for me or can someone tell me the way around.

See this JSFiddle for a demonstration

In the addNew() method.  I'm just trying to display the value of this.get("displayDropDownValue") which is, a calculated field.  It seems the only way to get this to work properly is to REPLICATE all of the code inside the displayDropDownValue field and put it in the new addNew() method as well.

Any suggestions?  Help?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 May 2012, 08:55 AM
Hello,

 The get method will return the function itself and won't invoke it automatically. You should invoke the displayDropDownValue method before using it. Here is the updated jsFiddle: http://jsfiddle.net/korchev/HuTpj/36/ 

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MVVM
Asked by
Jay
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or