JsRender系列demo-对null 和boolen类型数据的探讨
废话不说了,直接上代码
<!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>
结果显示:

JsRender系列demo-对null 和boolen类型数据的探讨的更多相关文章
- JsRender系列demo(7)compline
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
- JsRender系列demo(9)自定义函数
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(6)-无名
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
- JsRender系列demo(5) for else
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(4)-if else
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(3)-自定义容器
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(2)多模板-template
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(1)-insert-data
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- Struts2+Jquery实现ajax并返回json类型数据
来源于:http://my.oschina.net/simpleton/blog/139212 摘要 主要实现步骤如下: 1.JSP页面使用脚本代码执行ajax请求 2.Action中查询出需要返回的 ...
随机推荐
- 【学习】Windows PE文件学习(一:导出表)
今天做了一个读取PE文件导出表的小程序,用来学习. 参考了<Windows PE权威指南>一书. 首先, PE文件的全称是Portable Executable,可移植的可执行的文件,常见 ...
- 【风马一族_windom】 批量修改相同文件类型的后缀
难题:有时因为某种原因,修改一堆文件的类型,重复操作次数多,浪费时间也跟着多,收获也会相当少. 提问:对于软件而言,可量化的,有规律的操作,可以使用程序来进行替代. 特性:在微软操作系统上,不同后缀的 ...
- ADO.NET笔记——使用DataSet返回数据
相关知识: DataSet和DataAdapter的内部结构: DataSet通过DataAdapter从数据库中获取数据 DataSet对象内部包括一个集合(Tables),也就是可以拥有多个表(D ...
- Linux多命令协作:管道及重定向
- PHP 图片文件上传代码分享
分享下php上传图片文件的一段代码,挺不错的. 通过 PHP,可以把文件上传到服务器.加入一些图片的判断,如果不加判断文件的类型就可以上传任意格式的文件. 当然了,会禁止上传php文件,以及其它程序代 ...
- DML,DDL,DCL,DQL的区别
DML 英文缩写 DML = Data Manipulation Language,数据操纵语言,命令使用户能够查询数据库以及操作已有数据库中的数据的计算机语言.具体是指是UPDATE更新.INS ...
- Linux 使用退格键时出现^H解决方法
当我们再和脚本交互的时候,在终端上输错了内容,使用退格键,屏幕上会出现乱码,比如 ^H.^H不是H键的意思,是backspace. 主要是当你的终端backspace有问题的时候才需要设置. 解决方法 ...
- 用Tupper自我指涉公式造图
塔珀自指公式是杰夫·塔珀(Jeff Tupper)发现的自指公式:此公式的二维图像与公式本身外观一样.此公式在众多数学与计算机科学课程里被用作绘制公式图像的练习作业. 公式最初于他2001年SIGGR ...
- oracle数据库一些问题
1.oracle12安装的过程中需要注意字符的选择(特别注意 选择ZHS16GBK 国内企业大多选这个 否则创建数据的时候会出现中文变成问号) 2.设置密码是必须是大小写混合的 pl/sql32链 ...
- MySQL通过Binlog恢复删除的表
查看log-bin是否开启:mysql> show variables like '%log%bin%';+---------------------------------+-------+| ...