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

change event not raised when defined in the model definition

1 Answer 36 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
fbaptiste
Top achievements
Rank 1
fbaptiste asked on 04 Dec 2014, 08:09 PM
on version 2014.2.1008, I have the following simplified model definition:

var MyModel = kendo.data.Model.define({
    id: "MyModelID",
 
    // events
    change: function (e) {
        // do smth here
    },
 
    set: function (field, value) {
        // do smth here
    }
}

while the set event is being triggered as expected, the change event does not.
however, it does trigger when i define it outside of the definition scope as follows:

myModel = new MyModel(obj);
myModel.bind("change", function (e) {
    //do smth here
});

I'm trying to keep the logic of models grouped together, and that's why i'd rather use the first implementation. any solutions for this?

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 08 Dec 2014, 12:00 PM
Hello Fred,

the model definition does not accept change event handlers in its definition. This seems a bit inconsistent with the widget behavior - I will log it for further consideration from our development team.

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