pushCreate
Appends the specified data items to the data source without marking them as "new". The data source will not sync data items appended via pushCreate
.
The difference between
pushCreate
andadd
is that items appended viaadd
are synced with the remote service.
Parameters
items Object|Array
The data item or data items to append to the data source.
Example - pushCreate with a single item
<script>
var dataSource = new kendo.data.DataSource({
schema: {
model: {
id: "id"
}
}
});
dataSource.pushCreate({ id: 1, name: "John Doe" });
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.at(0).name); // displays "John Doe"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.at(0).isNew()); // displays "false"
</script>
Example - pushCreate with multiple items
<script>
var dataSource = new kendo.data.DataSource({
schema: {
model: {
id: "id"
}
}
});
dataSource.pushCreate([
{ id: 1, name: "John Doe" },
{ id: 2, name: "Jane Doe" }
]);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.at(1).name); // displays "Jane Doe"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(dataSource.at(1).isNew()); // displays "false"
</script>