This is a migrated thread and some comments may be shown as answers.
"Too much recursion" error when binding to nested observable function dependant method
1 Answer 9 Views
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 21 Nov 2018, 09:23 PM

I'm getting a "too much recursion" error when using a kendo.observable with nested dependent method. I have a nested observable object that needs to get and set values for a field depending on another field's value, so I used the example from the ObservableObject docs, where you have a field bound to a function that gets or sets a value based on whether a parameter is passed in.  This works great when the function is on the top level of the kendo.observable, but when it's nested several levels deep, there's some odd behavior...  Here's a Dojo example:

https://dojo.telerik.com/UpUcaxaP/2

It seems to work when you call the nested dependent function directly in JS or from the console, but as soon as it's bound to the HTML input field with data-bind, it gives the "too much recursion" error.  If you comment out the "this.set('nestedValue', param);" line, then you don't get the recursion error on binding, but when you change the value in the input box you get "TypeError: d.fields is undefined".  I've tried with both the straight use of "this" and also with the "self" one-liner referenced in my other post, and haven't been able to get it to work correctly.  Any ideas on what I'm doing wrong?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 23 Nov 2018, 01:44 PM
Hello Sam,

Similarly to the other thread binding the value of the input to a nested method can be done by using a template. Here's the updated dojo.

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MVVM
Asked by
Sam
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or