Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

canJS: load model with associations, but only save the “base” model

$
0
0

Here is a demo, how to load a model with associations (in a single request) in canJS. I found it in thegithub repo of canJShere, and actually I had to rewrite it a little bit to work (it was outdated), but it works now.

My problem is, that if I change a loaded contact (contact.attr('name', 'Tom');), and then I want to save it (contact.save();), then the contact, and also the contact's tasks will be posted via ajax to the server, to be saved. This is logical, because the tasks is an attribute of contact.

My problem is, that I only want the contact namebirthday and id to be posted when updating a record. I probably should override the makeRequest method, and remove tasks before posting to server, but I thinks there should be a more elegant solution.

Hopefully there are some canJS users here, who handled this situation already.


Viewing all articles
Browse latest Browse all 3491

Trending Articles