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

Observable set event not firing when using templates

1 Answer 90 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 06 Sep 2012, 02:44 PM
When updating a field directly bound to a model both the Set and Changed events on the model are triggered. However when I update a field that has beeen bound using a template, only the changed event is triggered.
I guess I'm doing something wrong.
An example of the issue is here
http://jsfiddle.net/stephenrjames_uk/K8Q6D/3/

If you update the Template Field you will see just the changed event firing whereas updating the bound field triggers 1 set and 3 changed events.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 11 Sep 2012, 11:58 AM
Hello Steve,

Thank you for providing a jsFiddle example that illustrates the issue.
Actually the set event fires, but the confusion comes from the fact that it does not bubble up. If you hook up to the viewModel property directly you would be able to bind the event. As an example:
viewModel.data.rows[0].bind("set", function(e) {
    jQuery("#tx").val(jQuery("#tx").val() +"\n"  + e.field + " set");
});

For convenience I updated the example: http://jsfiddle.net/valchev/K8Q6D/5/ 

Regards,
Alexander Valchev
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
Steve
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or