Backbone.js的局部模型更新 [英] Backbone.js partial model update

查看:127
本文介绍了Backbone.js的局部模型更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能保存更改时发送模型只是修改的属性?

Is it possible to send just the modified properties of a model when saving the changes?

BTW,是否有任何官方Backbone.js的组/邮件列表问这样的问题?

BTW, Are there any "official" Backbone.js group/mailing list to ask this kind of questions?

推荐答案

目前骨干网不支持发送模型到服务器的一部分。这将是一个有趣此外,虽然

Currently backbone does not support sending part of the model to the server. It would be an interesting addition though.

如果您浏览源你可以看到 Backbone.sync (骨干,负责与数据存储通信的一部分)在骨干最简单的组件之一,仅包装jQuery的或的Zepto。

If you browse the source you can see that Backbone.sync (the part of backbone that is responsible for communicating with the data store) is one of the simplest components in backbone and simply wraps the ajax support in jQuery or Zepto.

结果
更新

开始主干版本0.9.10,局部模型更新是通过本地

starting backbone version 0.9.10, partial model update is supported natively via

model.save(attrs, {patch: true})

这篇关于Backbone.js的局部模型更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆