Creating Knockout User Experiences in SharePoint

March 20, 2018 | Author: Anonymous | Category: N/A
Share Embed


Short Description

Download Creating Knockout User Experiences in SharePoint...

Description

Creating Knockout User Experiences in SharePoint with JavaScript Making awesome with Knockout, jQuery and SharePoint REST

Plugs  John Liu - I work with SharePoint Gurus in Sydney. We are a consultancy that delivers awesome SharePoint solutions for our happy clients.  Australian SharePoint Conference - March 20-21, in Melbourne. I'm covering a developer topic on custom REST services and Knockout.  SharePoint Saturdays later in the year TBA  InfoPath is cool. Don't diss InfoPath :-(

Contents

 Demo, demo, demo (5 demos)  Tricks

 Risks  Related techniques

Picture - build this in 1 sesson

Demo - ko

 …0

Demo - ko.mapping

 …1

Demo - SP2010 REST

 …2  listdata.svc  GET interface

Demo - SP2010 REST

 …3  POST

 MERGE  Remember e-tag

Demo - crazy

 … everything!

Current issues

 Debugging is not as great as Visual Studio. You'll need to know how to use the browser's JavaScript debugger fairly well  Not all binding errors show up in the console log sometimes you only see an error when you debug  It is possible to create circular dependency graphs and then your JavaScript will slow to a dog!

Tricks

 IE developer toolbar  Using HTML inspector  Using JavaScript debugger  Using Network inspector

Risk: Is this mainstream?  Knockout is created as an open source project, by Steve Sanderson. Who is actually a Microsoft Program Manager in the ASP.NET team.  There are other template engines but they aren't as mature - some are still in beta. Knockout is stable and in version 2 already.  Has been proven to work for ASP.NET WCF, ASP.NET MVC, Ruby on Rails, and now SharePoint ;-)  Knockout supports other template engine as plugins.

Risk: looks difficult to learn

 A good grasp of the concepts is the right starting point hopefully I've provided that

 Next, go through the demos and experiment, and use that as a reference to build your own creations

What about if you can't use REST?

 You can use it with the client object model, load SPItem via SP.ClientContext and then use ko.mapping  For SP2007, you can also use SPServices.codeplex.com which is a JavaScript wrapper library around SharePoint 2007/2010 SOAP Services  You can also use KO with your own custom REST services

Whoa! We don't do dirty Content Editor webparts!

 Take the entire content of the html file, and put it into a sandbox visual web part. This will create a sandbox solution and you can deploy that within your site collection.

Cool pictures

Downloads

 Knockout: http://knockoutjs.com/  Knockout.Mapping: https://github.com/SteveSanderson/knockout.mapping/t ree/master/build/output

References  SP2010 REST - http://msdn.microsoft.com/enus/library/ff798339.aspx  http://knockoutjs.com/documentation/introduction.html  https://www.nothingbutsharepoint.com/sites/devwiki/art icles/Pages/Applying-the-MVVM-pattern-to-createSharePoint-list-driven-interactive-tools-usingKnockout.aspx  https://www.nothingbutsharepoint.com/sites/devwiki/art icles/Pages/SharePoint-Development-Using-HeadJSKnockoutJS-And-SPServices.aspx

References

 SPServices https://www.nothingbutsharepoint.com/sites/eusp/Page s/jQuery-Library-for-SharePoint-Web-Services(SPServices)-v0.7.1-Released-.aspx

Summary Saw lots of demos Tricks

Risks Related techniques

 http://johnliu.net

 @johnnliu (twitter)

View more...

Comments

Copyright © 2017 DOCUMEN Inc.