Skip to content

Commit

Permalink
Parse offline pristine data. Fixes #1442
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosen Konstantinov committed Feb 16, 2016
1 parent ea1c88f commit b4081bc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/kendo.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3270,7 +3270,7 @@ var __meta__ = { // jshint ignore:line
this.offlineData(state.concat(destroyed));

if (updatePristine) {
this._pristineData = state;
this._pristineData = this._readData(state);
}
}
},
Expand Down
27 changes: 27 additions & 0 deletions tests/data/datasource/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,33 @@
equal(dataSource.total(), 1);
});

test("synced inserted item remains after cancelChanges - with projection", function() {
var dataSource = new kendo.data.DataSource({
offlineStorage: "key",
data: [{ Foo: "baz", id: 1 } ],
schema: {
model: {
id: "id",
fields: {
foo: { from: "Foo" }
}
}
}
});

dataSource.read();

dataSource.online(false);

dataSource.add( { foo : "foo" });
dataSource.sync();

dataSource.cancelChanges();

equal(dataSource.total(), 2);
equal(dataSource.at(1).foo, "foo");
});

test("synced inserted item remains after cancelChanges", function() {
var dataSource = new kendo.data.DataSource({
offlineStorage: "key",
Expand Down

0 comments on commit b4081bc

Please sign in to comment.