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

The parse function of kendo.data.Model not triggered when create a new Model

1 Answer 227 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
qu
Top achievements
Rank 1
qu asked on 17 Dec 2013, 06:26 AM
Hello, Kendo Team
  I'm studying Kendo UI Mobile data binding features and has a problem,when define a parse function for  kendo.data.Model  in "fields" section,the function has not triggered when create a new instance of the Model.
var Person = kendo.data.Model.define({
    fields: {
        name: {
            editable: true,
            from:"name",
            parse:function(v){
               console.log('parse name..., v=' + v);
               return v;
            }
        },
        age:{
        type:"number"
        }
    }
});
 
 
 
var person = new Person( {
    name: "John Doe",
    age: 42
});
In above code,the parse function is not triggered when create a new Person.
My question is:
How about he parse function works, any advices for parse function usage?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 17 Dec 2013, 08:37 AM
Hello,

The parse function will be invoked when you try to set a field via the set method of the model e.g.

person.set("name", "value");

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