English 中文(简体)
Should i spend my effort implementing knockoutjs or look into jQuery Data Link [closed]
原标题:
最佳回答

I d stick with Knockout personally -- it s already been demonstrated to work quite well, it s in active development, and it knocks data-link off the charts when you compare features. In short, Knockout seems ready for prime time, while data-link feels unfinished.

(I stress tested Knockout by having it data-bind a dropdown to an array of 5,000 items, while also calculating the number of unique items in the array and adding that to another data-bound element. My calculations and the re-painting of the browser chrome took far longer than the data-binding and updating.)

Now, that being said, I would keep an eye on data-link and probably continue to play around with it -- if it gets off the ground, it will be a very viable alternative. (Given the success of jquery-tmpl, the other major piece to come out of the Microsoft-Jquery cooperation.)

The better one to compare Knockout to would be documentcloud s backbone. I m looking into backbone next week, so I don t have any good recommendations for now, but I ve been very impressed with underscore (another of their projects), so I would definitely recommend looking into it as an alternative.


The score 4 years later
for those who are wondering

Knockout has been used in production on all kinds of projects for years, is now at version 3, and has a healthy ecosystem around it. jQuery.datalink became JSViews, which is still in beta.

问题回答

I ve been doing some serious digging into Knockout, and I m finding it reliable and extensible. Once you get into the mindset, I think it s the best developer experience I ve seen in the browser.

Please notice that jQuery data link only works on Form elements. Knockoutjs work on many other types of bindings, such as attributes, css, which is very useful.

ko is useful for model pubsub to forms. To use widgets, one must write custom bindings. ko doesn t support AJAX directly.

backbone is useful for model persistence via RESTful JSON. It supports model/view sync weakly: model->view via JS template. view->model via widget handlers one must code.

ko & backbone don t support validation directly. (I don t count bb s model.validate() since one must write code to validate each attribute.) They don t have a data type concept. (extjs models have types and validation. Unfortunately, I ve found extjs to be unreliable and inconsistent (data binding is integrated into the grid but not the form or property sheet; type information must be entered on grid cols and form fields though it is already present on the model).)

Even if one mixes ko, backbone, and jquery validation, there s a lot of code to write.

The most productive UI framework I ve found is JSF2 since it handles all of this. Unfortunately, in practice it has problems.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签