cancel

Cancels any changes to the data source and restore the data list to its original state - the state after the last read operation.

var dataSource = new shield.DataSource({
    read: "/get_all.php",
    modify: {
        create: "/handle_updates.php",
        update: "/handle_updates.php",
        remove: "/handle_updates.php"
    }
    schema: {
        fields: {
            Id: { path: "id", type: Number },
            Name: { path: "name", type: String }
        }
    }
});

// populate the data source with data
dataSource.read();

...

// insert a new item at the end
dataSource.add({
    Id: ++max_id,
    Name: "New Item Name"
});

// reset any changes to the data source
dataSource.cancel();