5 Minutes with Data Binding and JavaScript using Knockout and JsViews
For years when developers heard the term “data source control” it sent shivers down spines. It often referred to some tightly coupled object that managed binding the source data to the target controls and took you about 80% of the way t your goal. But it also often left you at the middle of the desert heat with nothing but a pair of sunglasses and a and a long way to go by foot to your destination as it drove off.
Thankfully, data sources and data binding have evolved considerably over the years and produced some fantastic solutions in various technologies that are both robust and extensible. Silverlight (and XAML) is one of the best shining examples of this. JavaScript has several data binding solutions, some of which have taken their queue from XAML bindings. 2 great solutions I have been impressed with are Knockout (now at v 2.0.0) and JsViews (not yet in beta, but coming soon). Note that til JsViews is fully released, I expect API changes.
Knockout is a library by Steve Sanderson that has a native templating engine (and also supports external templating libraries such as jQuery templates). JsViews is driven by Boris Moore (you may know him from jQuery templates) and offers a slightly different approach while pairing its templating with JsRender (soon to be the templating engine de jour).
This month’s Papa’s Perspective hits both Knockout and JsViews from a high level to show how you can get started with them and their basic syntax, with examples. Take a look!
If you want to learn more about Knockout, be sure to check out my Pluralsight course on Knockout and MVVM , coming in mid-February –2012 !