Knockout and SharePoint - Simple Example

Hi All,

As you all know, client side technology is powerful and I am a fan of it. Apart from being fast and no postback is required, it is relatively easy to develop compared to hefty server side code.

However you should keep in mind that your code can be easily tracked and downloaded so if you have sensitive information and logic that needs to be secured then you need to use server side code :) You can do hybrid application though and that is probably the best way to go.

In this example I will show you how easy to get the data out of SharePoint list and display it with a little user interactivity. This web part consists of a user control and it basically displays a land mass comparison in boxes. Most of the times people do not realize how big WA is in comparison to their own country and when they come here they find out that they need 1-2 days to get to the other region.

End result will look like this:



We will be using:
1. jQuery + Knockout 2.1.0 for the awesomeness
2. SPServices to get the data from SharePoint list

The Html:


The Javascript:


That's it! How simple that is :)
P.S: I avoid using drawing plugin etc. because for these simple boxes we can just use square div tags ;)

Hope this helps,
Andreas