我相信现在可以只将客户端模型的一部分保存到服务器,但是是否可以只获取其中的一部分?
有什么比:
var sectionName = "overview";
model.fetch({ data: $.param({ section: sectionName}) });
理想情况下,我宁愿声明要更新的模型的特定属性。
我相信现在可以只将客户端模型的一部分保存到服务器,但是是否可以只获取其中的一部分?
有什么比:
var sectionName = "overview";
model.fetch({ data: $.param({ section: sectionName}) });
理想情况下,我宁愿声明要更新的模型的特定属性。
As far as I know, there is no backbone specific way to do exactly what you want exactly as you describe it, but if your model has group-able properties like:
bobTheUser = {
posts: [
{
id:1,
content: "This is Bob's first post!"
}, {
id:2,
content: "Wow! Another stunner!"
}
],
friendIds: [1729, 3301],
salesforce: {oh: "no! SOAP!!!"}
}
You can pass fetch
optional parameters to let your api know that you just want Bob's posts
and friendIds
, but not his salesforce
information.
I think this type of solution is about as close as you'll get to what you asked for, but I've been wrong before!