using the asp.net lego blocks to create a synchronized Kanban board.

Over the last 1-2 years the capabilities of the web lego blocks (libraries) have really come together to allow us, the web development community. to start putting together some really interesting applications. The best part is all of the plumbing code is in the libraries. You can know write a rich user experience without having to write a lot of code. The example app uses ASP.Net MVC, ASP.Net WebAPI, SignalR, KnockoutJSjQuery, jQuery UI, and Twtitter Bootstrap.

If you are really interested in this project, fork it on github https://github.com/erichexter/SyncKanbanSample

A Synchronized Kanban board

A kanban board is pretty simple, it has a collection of vertical swim lanes and items that move from one lane to the next, from left to right.  Below is a screen shot of the application I put together in a few hours. The interesting features are you can click and drag a post it note from one column to another, this is then saved on the server behind the scenes. Then if two people are looking at the same board, the changes will be synchronized on each others web browser in real time.

image

To allow the drag and drop, I used the jQuery UI Sortable interaction.  To enable the mulit browser syncronization I used a combination of KnockoutJS and SignalR.

Here is an example of the synchronization.

To view this on youtube go here http://www.youtube.com/watch?v=MXQwhfHzRls&feature=youtu.be

The Code:

To create the initial screen us use the following code:

ASP.Net MVC Action -

The code in this action will retrieve a board including the collection of lists and tasks and pass that model to the mvc View.

image

Below is the Board Viewmodel

image

image

Here is the MVC view.  A majority of the code is the client side templating. All of the data-binding is the KnockoutJS client side binding syntax.

image

The script on the page wires up the knockout bindings, a jQuery Sortable knockout plugin, and the signalR initialization code.

image

The code below shows the SignalR server side code “Hub”. The two main server side code snippets is the getAllLists, which will send down all the lists and tasks when the board initializes. The second method is the movedTask method which is executed when a card is dropped in a column.

image

The last piece of code which ties this together is some more client side code which is the client side viewmodel.

This is where the client side code wires up the Sortable Drop with the signalR code to call the server side hub.

image

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Eric Hexter

I am the CTO for QuarterSpot. I (co)Founded MvcContrib, Should, Solution Factory, and Pstrami open source projects. I have co-authored MVC 2 in Action, MVC3 in Action, and MVC 4 in Action. I co-founded online events like mvcConf, aspConf, and Community for MVC. I am also a Microsoft MVP in ASP.Net.
This entry was posted in Asp.Net, Asp.Net MVC, jQuery, jquery mobile, knockoutJs, Open Source Software, signalR. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Dave Van den Eynde

    Dude, you rebuilt Trello!

    • Jason Cavaliere

      I was thinking the exact same thing!

      • erichexter

        LOL. yes, I did.. it is much simpler but it is a good starting point.

  • YCR

    Very Nice!!

  • Shawn Hartsell

    Very cool, we’ve been working on building SignalR into our Kanban product here at LeanKit (shameless plug :D ) to great success. Lately, we’ve been working out scaling it in a distributed environment.

  • http://twitter.com/RichardAZ Richard Scheffrin

    I really. enjoyed reading. this blog post.