JsRender系列demo-对null 和boolen类型数据的探讨
2014-09-13 00:39
204 查看
废话不说了,直接上代码
结果显示:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script type="text/javascript" src="scripts/jquery.js"></script> <script type="text/javascript" src="scripts/jquery-ui.js"></script> <script type="text/javascript" src="scripts/jsrender.js"></script> <link href="scripts/demos.css" rel="stylesheet" /> <link href="scripts/movielist.css" rel="stylesheet" /> </head> <body> <script type="text/html" id="userinfoTemplate"> {{for Items}} <tr><td>{{:name}}</td><td>{{:Age}}</td><td>{{:IsOpen?'结婚':'未婚'}}</td></tr> {{/for}} <tr> </tr> </script> <table> <thead> <tr> <th>Title</th> <th>Languages</th> </tr> </thead> <tbody id="movieList"></tbody> </table> <table> <thead> <tr> <th>姓名</th> <th>年龄</th> <th>婚否</th> </tr> </thead> <tbody id="userInfo"></tbody> </table> </body> </html> <script type="text/javascript"> $(function () { var data = { DataCount: 138, PageIndex: 2, PageCount: 3, Items: [ { name: "刘建伟", Age: 12, IsOpen: false }, { name: "小全", Age: 13, IsOpen: true }, { name: "小刚", Age: 14, IsOpen: false }, { name: "撞墙", Age: null, IsOpen: false }, { name: null, Age: 15, IsOpen: true }, { name: "小娥", Age: 16, IsOpen: false }, { name: "小娜", Age: 17, IsOpen: false }, ] }; $("#userInfo").html($("#userinfoTemplate").render(data)); }); </script>
结果显示:
相关文章推荐
- 深入Atlas系列:Web Sevices Access in Atlas(4) - 对于复杂数据类型的支持(上)
- 深入Atlas系列:Web Sevices Access in Atlas(5) - 对于复杂数据类型的支持(中)
- 『C程序设计』读书笔记系列文章之第二章 数据类型、运算符与表达式
- C#基础系列(1)-- 第一部分 基础数据类型与操作 -- 位运算(1)
- 自定义数据类型转换Demo
- 全面探讨PL/SQL的复合数据类型
- windows server 2003 DNS 细谈系列之(二)记录类型、数据库
- MySQL查询优化系列讲座之数据类型与效率
- 将 varchar 值 'null' 转换为数据类型为 int 的列时发生语法错误。
- 回复:null是什么数据类型
- C#基础系列(3)-- 第一部分 基础数据类型与操作 -- 位运算(3)
- 深入Atlas系列:Web Sevices Access in Atlas(4) - 对于复杂数据类型的支持(上)
- ExcelVBA编程系列之数据类型(1):常量
- MySQL查询优化系列讲座之数据类型与效率
- sql 优化之关于null 和数据类型
- 深入Atlas系列:Web Sevices Access in Atlas(6) - 对于复杂数据类型的支持(下)
- 深入Atlas系列:Web Sevices Access in Atlas(5) - 对于复杂数据类型的支持(中)
- javascript 简单高效判断数据类型 系列函数 By shawl.qiu
- SQLServer陷阱(一) NULL与布尔数据类型
- C#基础系列(4)-- 第一部分 基础数据类型与操作 -- 枚举类型与位标志(4)