Hello,
I'm experiencing some weird behaviour with the remove() method of Kendo bound to Telerik Backend Services.
All CRUD operations work as expected as long as I don't reset the application.
However, after I reset the application, I cannot delete previously added items anymore. I can edit them, add new ones - but I can't delete the old ones. The items are removed from the (locally), but they are not deleted from the server.
Here's the relevant part of my code
<div data-role="view" id="ClientsView"
data-model="clientsViewModel">
<div data-role="header">
<div data-role="navbar">
<span>Clients</span>
</div>
</div>
<div >
<a data-role="button" data-bind="click:CreateFunc">create</a>
<a data-role="button" data-bind="click:deleteFunct">delete</a>
<ul data-role="listview" data-style="inset"
data-bind="source: test"
data-template="customersTemplate">
</ul>
</div>
</div>
<!-- Template for clients list -->
<script id="customersTemplate" type="text/x-kendo-template" >
<a data-role="listview-link" ">
<div class="info">
<span class="name">#: name # </span>
</div>
</a>
</script>
------------------
var el =new Everlive("gl6p2yayysidisxh");
var clientsViewModel = kendo.observable({
test : new kendo.data.DataSource({
type: 'everlive',
transport: {
typeName: 'test'
},
schema: {
model: { id: Everlive.idField }
},
offlineStorage: "test-offline2",
}),
CreateFunc: function(){
var data= clientsViewModel.test.data()
var itemToAdd = {
'name': 'Harper Lee'
};
clientsViewModel.test.add(itemToAdd);
console.log(itemToAdd);
clientsViewModel.test.sync();
},
deleteFunct :function(){
clientsViewModel.test.fetch(function () {
var data= this.data()
console.log(data);
var itemToDelete = this.at(0);
this.remove(itemToDelete);
console.log(itemToDelete);
// Send the changes to Telerik Platform
this.sync();
});
},
})