Fast Template will take a set of JSON data, an HTML template on the document and a wrapper node. It will quickly loop over the rows in the data and process the html template for each row populating variables in the HTML template. The variables should be named the same as the key in the data. For example if the key in the data is first_name, your HTML would contain a variable called {first_name}. It will then be replaced with the value of the first_name key.
var myData = [ { 'first_name': 'foo' } ];
var myTemplate = new Y.fastTemplate({
data: mydata,
templateNode: Y.one('#template'),
wrapperNode: Y.one('#wrapper')
});
myTemplate.process();
| Subject | Author | Date |
|---|---|---|
| Using Fasttemplate | Santhosh Nageshwar Rao | 02/18/11 |
| Re: Using Fasttemplate | Santhosh Nageshwar Rao | 02/19/11 |
| Re: Using Fasttemplate | David Martin | 02/19/11 |
| Re: Using Fasttemplate | Santhosh Nageshwar Rao | 02/19/11 |
| Re: Using Fasttemplate | David Martin | 02/21/11 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info