Hi all!
I am very beginner in Kendo, so sorry if I ask stupid questions :)
I have the following code:
var template = kendo.template($("#todo-template").html());
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "api/todos",
dataType: "json"
},
create: function () {
alert("DSA");
}
},
schema: {
model: { id: "TODOID" }
},
change: function () { // subscribe to the CHANGE event of the data source
$("#todo-table tbody").html(kendo.render(template, this.view())); // populate the table
}
});
dataSource.read();
$("#add-button").click(function () {
dataSource.add({
"TODOID": 30,
"TITLE": "asd",
"PRIORITY": 3,
"DEADLINE": "2013-02-02",
"DONE": false
});
dataSource.sync();
});
The problem is that the create event is never being called. The read is okay, the table is shown nicely. What would be the problem?
Sincerely,
Daniel
I am very beginner in Kendo, so sorry if I ask stupid questions :)
I have the following code:
var template = kendo.template($("#todo-template").html());
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "api/todos",
dataType: "json"
},
create: function () {
alert("DSA");
}
},
schema: {
model: { id: "TODOID" }
},
change: function () { // subscribe to the CHANGE event of the data source
$("#todo-table tbody").html(kendo.render(template, this.view())); // populate the table
}
});
dataSource.read();
$("#add-button").click(function () {
dataSource.add({
"TODOID": 30,
"TITLE": "asd",
"PRIORITY": 3,
"DEADLINE": "2013-02-02",
"DONE": false
});
dataSource.sync();
});
The problem is that the create event is never being called. The read is okay, the table is shown nicely. What would be the problem?
Sincerely,
Daniel