ホームページ > 記事 > ウェブフロントエンド > jQuery テンプレート テクノロジとデータ バインディングの実装 code_jquery
好消息来了,微软开发出了这样的框架,这是对jQuery的一个扩展,从此以后要在浏览器上动态显示服务器端Web Service返回的数据将变得如同用服务器端控件显示数据一样容易。
这个技术就叫jQuery templates and data linking ,这是微软对jQuery做的一个扩展。这种扩展需要jQuery官方的审核,然后才能被包含在jQuery中。据ScottGu的博客上说,此扩展正在等待审核阶段。但是这些功能却是非常强大而且实用,我就先把它转过来了,先睹为快。
在编写AJAX应用时,经常需要利用JavaScript在页面上显示数据,jQuery模板(jQuery Templates)和数据绑定(Data Linking)提供了一种方便的途径将JavaScript数据显示在HTML页面上,数据可以呈现为各种元素,如普通文本、TextBox、列表等。Data Linking这个单词直译应该作数据链接,但是我觉得数据绑定这个词更加能够反映这种技术的能容,而且符合ASP.NET习惯用法。在Scott Guthrie的博客中也这样说,原来他们也想称这种技术为data binding而不是data linking,但是由于jQuery中已经有binding这个术语了,指的是另外的东西,为了不至于引起混淆,所以就只好另外给它起个名字,叫data linking了。
我下面把这个博客转过来,有时间则翻译一下。
以下全文引用自ScottGu的博客。
The jQuery library has a passionate community of developers, and it is now the most widely used JavaScript library on the web today. Two years ago I announced that Microsoft would begin offering product support for jQuery, and that we'd be including it in new versions of Visual Studio going forward. By default, when you create new ASP.NET Web Forms and ASP.NET MVC projects with VS 2010 you'll find jQuery automatically added to your project. A few weeks ago during my second keynote at the MIX 2010 conference I announced that Microsoft would also begin contributing to the jQuery project. During the talk, John Resig -- the creator of the jQuery library and leader of the jQuery developer team – talked a little about our participation and discussed an early prototype of a new client templating API for jQuery. In this blog post, I'm going to talk a little about how my team is starting to contribute to the jQuery project, and discuss some of the specific features that we are working on such as client-side templating and data linking (data-binding). jQuery has a fantastic developer community, and a very open way to propose suggestions and make contributions. Microsoft is following the same process to contribute to jQuery as any other member of the community. As an example, when working with the jQuery community to improve support for templating to jQuery my team followed the following steps: There has been an amazing amount of participation by the jQuery community in response to the original templating proposal (over 100 posts in the jQuery forum), and the design of the templating proposal has evolved significantly based on community feedback. The jQuery team is the ultimate determiner on what happens with the templating proposal – they might include it in jQuery core, or make it an official plugin, or reject it entirely. My team is excited to be able to participate in the open source process, and make suggestions and contributions the same way as any other member of the community. Client-side templates enable jQuery developers to easily generate and render HTML UI on the client. Templates support a simple syntax that enables either developers or designers to declaratively specify the HTML they want to generate. Developers can then programmatically invoke the templates on the client, and pass JavaScript objects to them to make the content rendered completely data driven. These JavaScript objects can optionally be based on data retrieved from a server. Because the jQuery templating proposal is still evolving in response to community feedback, the final version might look very different than the version below. This blog post gives you a sense of how you can try out and use templating as it exists today (you can download the prototype by the jQuery core team at http://github.com/jquery/jquery-tmpl or the latest submission from my team at http://github.com/nje/jquery-tmpl). jQuery Client Templates You create client-side jQuery templates by embedding content within a Contributing to jQuery
jQuery Template Support