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中查询出需要返回的 ...
随机推荐
- 大数求模 sicily 1020
Search
- 基于JQuery+JSP的无数据库无刷新多人在线聊天室
JQuery是一款非常强大的javascript插件,本文就针对Ajax前台和JSP后台来实现一个无刷新的多人在线聊天室,该实现的数据全部存储在服务端内存里,没有用到数据库,本文会提供所有源程序,需要 ...
- UVA10361 -自动作诗机
UVA10361 - Automatic Poetry(自动作诗机) A Schuttelreim seems to be a typical German invention. The funny ...
- Laravel 5 基础(四)- Blade 简介
在多个页面中我们可能包含相同的内容,像是文件头,链接的css或者js等.我们可以利用布局文件完成这个功能. 让我们新建一个布局文件,例如 views/layout.blade.php <!doc ...
- Delphi XE5教程2:程序组织
内容源自Delphi XE5 UPDATE 2官方帮助<Delphi Reference>,本人水平有限,欢迎各位高人修正相关错误! 也欢迎各位加入到Delphi学习资料汉化中来,有兴趣者 ...
- 第27章 项目8:使用XML-RPC进行文件共享
1.问题 创建一个简单的P2P文件共享程序. P2P文件共享程序是在不同计算机上的程序交换文件.P2P交互内,任何节点(peer)都可以是链接到其他节点.在这样一个由节点组成的虚拟网络中,是没有中央节 ...
- Python原始套接字编程
在实验中需要自己构造单独的HTTP数据报文,而使用SOCK_STREAM进行发送数据包,需要进行完整的TCP交互. 因此想使用原始套接字进行编程,直接构造数据包,并在IP层进行发送,即采用SOCK_R ...
- Daject初探 - 一个开源关系型数据库对象关系映射(ORM)模型
Daject简介 Daject是用php写的一个关系型数据库抽象模型,通过该模型,可以在不写任何SQL或写很少的SQL就能执行大多数数据库查询操作.Daject具有面向对象,跨数据库的优点,通过数据库 ...
- mysql_fetch_row()与mysql_fetch_array()的使用介绍
mysql_fetch_array --从结果集中取得一行作为关联数组,或数字数组,或二者兼有 说明array mysql_fetch_array ( resource result [, int r ...
- 输入adb shell 时 提示error: more than one device and emulator
第一种情况:确实用多个设备或者模拟器 解决办法:(指定连接某一个设备或者模拟器) 1.获取模拟器/设备列表 adb devices 2.指定device来执行adb shell adb -s ...