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

Bind to nested, computer property

6 Answers 154 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 31 Jul 2012, 02:19 AM
In javascript how can you watch changes to a nested property or computed property on an observable object?

http://docs.kendoui.com/api/framework/observableobject#methods has observable.bind("change", function(e) { }); but this does not seem to update for nested properties/computed properties.

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 31 Jul 2012, 12:08 PM
Hello Jonathan,

 The change event should be raised for nested properties. Here is a live demo showing this in action: http://jsbin.com/iqukaz/1/edit 

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!
0
Jonathan
Top achievements
Rank 1
answered on 31 Jul 2012, 08:31 PM
Thank you. I did not realize that it would work for nested properties. How do you suggest watching computed properties
http://jsbin.com/iqukaz/3/edit 
0
Atanas Korchev
Telerik team
answered on 01 Aug 2012, 06:58 AM
Hello Jonathan,

 Could you please elaborate a bit on your requirement? What exactly are you trying to achieve?

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!
0
Jonathan
Top achievements
Rank 1
answered on 08 Aug 2012, 10:35 PM
Since I can watch nested properties, updating computed properties is not a large issue.

Although I have noticed an issue when trying to bind to nested arrays. Is there any guidance on a situation such as http://jsbin.com/abigum/2/edit?
0
Accepted
Atanas Korchev
Telerik team
answered on 09 Aug 2012, 03:06 PM
Hi Jonathan,

 What seems to be the problem?

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!
0
Jonathan
Top achievements
Rank 1
answered on 09 Aug 2012, 10:29 PM
I must have been very tired when I posted those two questions. Kendo MVVM is working well!!

I have had issues with binding to the mobile checklist form with nested properties, but it is likely something I am doing wrong. Instead of binding, I am manually observing changes and it works well.'

Thanks for your patience.
Tags
MVVM
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or