Hello,
It seems i might have ecnountered a possible problem with kendo.render() (the method suggested in "Batch CRUD Operations With Kendo UI DataSource" blog post for updating templates). I have several templates displaying the same data in different ways. In the DataSource, I defined a change method to update all the templates when the data is changes. The DataSource looked something like this:
So the change loops through the templates, and each template has a parent element where its supposed to be inserted too. But it didn't work. When the change ran, all the content defined in the templates simply disappeared (the parent elemets' content was repalced with nothing).
Altough when I rewrote it like this, it worked perfectly:
So instead of the render(), i use the template function directly, and hand the data to it.
What could the problem be? Whats the real difference between the two?
(The framework is awesome by the way! Thank you!)
Regards,
Greg
It seems i might have ecnountered a possible problem with kendo.render() (the method suggested in "Batch CRUD Operations With Kendo UI DataSource" blog post for updating templates). I have several templates displaying the same data in different ways. In the DataSource, I defined a change method to update all the templates when the data is changes. The DataSource looked something like this:
folderListData =
new
kendo.data.DataSource({
data: folderList,
schema: { model:folderModel },
change:
function
() {
for
(
var
i = 0; i < templates.length; i++) {
$(parents[i]).html(kendo.render(templates[i],
this
.view()));
}
}
});
So the change loops through the templates, and each template has a parent element where its supposed to be inserted too. But it didn't work. When the change ran, all the content defined in the templates simply disappeared (the parent elemets' content was repalced with nothing).
Altough when I rewrote it like this, it worked perfectly:
folderListData =
new
kendo.data.DataSource({
data: folderList,
schema: { model:folderModel },
change:
function
() {
var
data =
this
.view();
for
(
var
i = 0; i < templates.length; i++) {
$(parents[i]).html(templates[i](data));
}
}
});
So instead of the render(), i use the template function directly, and hand the data to it.
What could the problem be? Whats the real difference between the two?
(The framework is awesome by the way! Thank you!)
Regards,
Greg