Creating Knockout User Experiences in SharePoint with JavaScript and REST services
Monday, February 13, 2012 at 10:40AM
Sydney SharePoint user group is 21st of February. Where I'll be presenting Knockout, AJAX and REST services.
To many of us web/SharePoint developers, discovering jQuery made us love JavaScript again. Finally, here was a JavaScript library that made sense. It made everything a thousand times easier. Within years, jQuery had become the ubiquitous hammer in everyone's tool belt.
On the server side, SharePoint shipped with a complex Client Object model, REST services, and it is incredibly easy and flexible to build your own web services and use them in your solutions. Even for SharePoint 2007, SPServices has made huge improvements in bridging how you can talk to the server.
There is one final piece of the puzzle: how do we easily fit data that we've obtained from the server back into the web UI seamlessly? What if there's a way to do data binding, MVC/MVVM style, and leave both the object and the UI robust and free of spaghetti code?
Knockout solves one of the most difficult remaining problem in creating complex business solutions entirely using JavaScript. If you thought jQuery alone is awesome. Discovering Knockout is like finding another beautiful library like jQuery all over again!
In this session, John will demonstrate how to build a fairly complex system using Knockout and jQuery. As well as show examples of some of the systems that he's been building and the flexibility you can easily achieve with Knockout.
So bring your developer hats and be prepared to enjoy an evening of new exciting techniques! Don't be afraid to ask questions too!
Teaser Picture
Figure: this is your SharePoint task list, but supporting drag and drop!
See you at the Sydney SharePoint user group.
SharePoint 





Reader Comments (6)
John,
I'd love to see this presentation if there are slides, samples, etc. available. It's tough for me to get to Sydney.
Thanks,
Joe
Not sure where you are, but you missed a great session - there were about 30 of us last night and we had a lot of fun!
I've posted an update here:
There are files and a tips slide deck. But you don't have me to walk you through the demo in 1 hour, and explain the intricacies of what I'm doing in the files.
SSPUG retrospective: Creating Knockout user experiences in SharePoint with JavaScript
I would have loved to have seen it, but I"m in the US. Thanks for posting your materials!
Hi John,
Is it possible JSON.stringify an array of objects and pass it to Listdata.svc/Tasks? Essentially, a bulk update. Similar to
<Batch OnError="Continue" ListVersion="1" ViewName="">
<Method ID="1" Cmd="New">....</Method>
<Method ID="2" Cmd="Update">....</Method>
<Method ID="3" Cmd="Delete">....</Method>
</Batch
What is the best, most sustainable way to do this? Use CSOM, SPServices, REST API? Can KnockoutJS Mapping Plugin play a role in simplifying this task?Do you have any code examples that do this?
Thanks,
Mike
If you want to do a batch update, I'm going to guess CSOM would be the easiest to get going - since it batches operations in one hit when you executeAsync.
I have not tried Batching via the REST interface, I know it's possible, but I'm not sure if it's possible to do an Update via Batch.
SPServices wraps around the list.asmx and as far as I'm aware it does not support batching.
KnockoutJS is primarily a MVVM library and assists greatly with data binding, it doesn't have particularly spectacular ability when it comes to the actual request. I use jQuery to perform the AJAX request. Using Knockout mapping is great at preparing the objects for update - but for the actual update I still revert back to either jQuery.ajax (for REST) or CSOM.
I've done a bit of reading, there seems to be helper javascript functions in MicrosoftAjax library that can assist with batch ODATA operations.
Look for Sys.Data.OpenDataServiceProxy.
I'm still reading - no demo or examples yet. Let me know if you make progress.