I'm trying to sync changes to my remote datasource but it's only changing them locally.
Here's my code:
Datasource:
"Save Changes" Button Click: It might be a bit messy because I've been trying loads of different techniques
I can see the changes reflecting in my console when I check the console.log(dataSource); after the dataSource.sync(); but when I check my remote database there's no change.
Here's my code:
Datasource:
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "http://localhost:8080/databases/shipping/docs",
dataType: "json",
data: {
q: "javascript"
}
},
update: {
url: "http://localhost:8080/databases/shipping/docs",
dataType: "json"
}
},
schema: {
model: {
id: "id",
fields: {
Name: { type: "string" },
Telephone: { type: "string" },
Address: { type: "string" },
Suburb: { type: "string" },
City: { type: "string" },
Province: { type: "string" },
Country: { type: "string" },
PostalCode: { type: "string" },
DeliveryStatus: { type: "string" },
Packages: { type: "auto" }
}
}
}
});
"Save Changes" Button Click: It might be a bit messy because I've been trying loads of different techniques
var packageId;
function saveChanges(e) {
var button = e.button,
item = packageDataSource.get(button.data("itemId"));
packageId = item.ID;
dataSource.fetch(function () {
var packageToUpdate = dataSource.data()[id].Packages[packageId];
packageToUpdate.Status = "Delivered";
dataSource.sync();
console.log(dataSource);
});
}
I can see the changes reflecting in my console when I check the console.log(dataSource); after the dataSource.sync(); but when I check my remote database there's no change.