https://github.com/akiomik/backbone-batch-operations
batch operation plugin for backbone.js
https://github.com/akiomik/backbone-batch-operations
Last synced: 2 months ago
JSON representation
batch operation plugin for backbone.js
- Host: GitHub
- URL: https://github.com/akiomik/backbone-batch-operations
- Owner: akiomik
- License: mit
- Created: 2013-05-20T16:47:55.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-11-16T13:35:36.000Z (over 9 years ago)
- Last Synced: 2025-03-07T16:51:33.811Z (3 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
backbone-batch-operations
==========================
This is a backbone.js plugin provides batch operations.## Installation
Install with Bower:
```bash
bower install backbone-batch-operations
```Add following line to your html.
```html
```
## Sample
```javascript
var Document = Backbone.Model.extend({});
var Documents = Backbone.BatchCollection.extend({
model: Document,
url: 'http://example.com'
});
var docs = new Documents({});// Insert
var models = [
{'some': 'data'}
];
docs.add(models, {silent: true});
docs.save(); // POST// Update
docs.each(function(doc) {
var json = doc.toJSON();
json.some = 'data was modified';
doc.set(json, {silent: true});
});
docs.save(); // PUT// Delete
var models = docs.models;
docs.remove(models, {silent: true});
docs.save(); // PUT
```## Reference
### collection.save([options]);### collection.isNew();
### collection.isChanged();
## License
The MIT License. See `LICENSE` file.