backbone.js - Backbone collection export issues -
i have collection of users (model user) model has boolean value: isexport have button on click supposed post server users isexport=true can suggest suitable solution problem?
i know it's possible wrap collection model , overwrite tojson function couldn't manage far (can please give code example?)
app.user = backbone.model.extend({ defaults: {isexport: false}...}); app.users = backbone.collections.extend({model: app.user...});
thanks! roy
backbone collections default don't have write operations server, you'll need add new method collection subclass such doexport
, use .where
models isexport=true
, tojson()
array of objects can send server backbone.sync
or $.post
.
Comments
Post a Comment