MrTea
unread,Oct 28, 2010, 12:36:56 PM10/28/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KnockoutJS
Hi,
This is a bit of a noob question ;-( but given a view model, how can
you jsonify the entire thing to send back to the server?
var productViewModel = {
PartNumber: ko.observable(initialData.PartNumber),
Name: ko.observable(initialData.Name),
ShortDescription:
ko.observable(initialData.ShortDescription),
FullDescription:
ko.observable(initialData.FullDescription),
AdminComment: ko.observable(initialData.AdminComment),
Published: ko.observable(initialData.Published),
SelectedCategories:
ko.observableArray(ko.utils.arrayMap(initialData.AvailableCategories,
mapCategory)),
save: function() {
ko.utils.postJson(location.href, { productForm:
this });
}
};
This doesn't work, do I need to unwrap each observable property in
turn?
Thanks in advance,
Jon