Spry学习(二)----XML数据集及主从表显示
来源:互联网 发布:淘宝无线端首页装修psd 编辑:程序博客网 时间:2024/05/21 17:23
页面代码:
test.html
data.xml
summersalad.xml
thainoodles.xml
salmon.xml
test.html
1<head>
2 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
3 <title>Spry Example</title>
4
5 <!--Link the Spry libraries-->
6 <script type="text/javascript" src="includes/xpath.js"></script>
7 <script type="text/javascript" src="includes/SpryData.js"></script>
8
9 <!--Create a data set object-->
10 <script type="text/javascript">
11 var dsSpecials = new Spry.Data.XMLDataSet("data.xml", "specials/menu_item");
12 var dsIngredients = new Spry.Data.XMLDataSet('{dsSpecials::url}', "item/ingredients/ingredient");
13 </script>
14</head>
15
16<body>
17
18 <!--Create the Spry dynamic region-->
19 <div id="Specials_DIV" spry:region="dsSpecials">
20 <!--Display the data in a table-->
21 <table id="Specials_Table">
22 <tr>
23 <th>名称</th>
24 <th>Description</th>
25 <th>价格</th>
26 </tr>
27 <!--<tr spry:repeat="dsSpecials">-->
28 <tr spry:repeat="dsSpecials" onclick="dsSpecials.setCurrentRow('{ds_RowID}')">
29 <td>{item}</td>
30 <td>{description}</td>
31 <td>{price}</td>
32 </tr>
33 </table>
34 </div>
35<hr>
36 <!--Create the detail dynamic region-->
37 <div id="Specials_Detail_DIV" spry:region="dsIngredients">
38 <table id="Specials_Detail_Table">
39 <tr>
40 <th>Ingredients</th>
41 </tr>
42 <tr spry:repeat="dsIngredients">
43 <td>{name}</td>
44 </tr>
45 </table>
46 </div>
47</body>
2 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
3 <title>Spry Example</title>
4
5 <!--Link the Spry libraries-->
6 <script type="text/javascript" src="includes/xpath.js"></script>
7 <script type="text/javascript" src="includes/SpryData.js"></script>
8
9 <!--Create a data set object-->
10 <script type="text/javascript">
11 var dsSpecials = new Spry.Data.XMLDataSet("data.xml", "specials/menu_item");
12 var dsIngredients = new Spry.Data.XMLDataSet('{dsSpecials::url}', "item/ingredients/ingredient");
13 </script>
14</head>
15
16<body>
17
18 <!--Create the Spry dynamic region-->
19 <div id="Specials_DIV" spry:region="dsSpecials">
20 <!--Display the data in a table-->
21 <table id="Specials_Table">
22 <tr>
23 <th>名称</th>
24 <th>Description</th>
25 <th>价格</th>
26 </tr>
27 <!--<tr spry:repeat="dsSpecials">-->
28 <tr spry:repeat="dsSpecials" onclick="dsSpecials.setCurrentRow('{ds_RowID}')">
29 <td>{item}</td>
30 <td>{description}</td>
31 <td>{price}</td>
32 </tr>
33 </table>
34 </div>
35<hr>
36 <!--Create the detail dynamic region-->
37 <div id="Specials_Detail_DIV" spry:region="dsIngredients">
38 <table id="Specials_Detail_Table">
39 <tr>
40 <th>Ingredients</th>
41 </tr>
42 <tr spry:repeat="dsIngredients">
43 <td>{name}</td>
44 </tr>
45 </table>
46 </div>
47</body>
data.xml
<?xml version="1.0" encoding="UTF-8"?>
<specials>
<menu_item id="1">
<item>夏日沙拉</item>
<description>organic butter lettuce with apples, blood oranges, gorgonzola, and raspberry vinaigrette.</description>
<price>7</price>
<url>summersalad.xml?id=1</url>
</menu_item>
<menu_item id="2">
<item>Thai Noodle Salad</item>
<description>lightly sauteed in sesame oil with baby bok choi, portobello mushrooms, and scallions.</description>
<price>8</price>
<url>thainoodles.xml</url>
</menu_item>
<menu_item id="3">
<item>Grilled Pacific Salmon</item>
<description>served with new potatoes, diced beets, Italian parlsey, and lemon zest.</description>
<price>16</price>
<url>salmon.xml</url>
</menu_item>
</specials>
<specials>
<menu_item id="1">
<item>夏日沙拉</item>
<description>organic butter lettuce with apples, blood oranges, gorgonzola, and raspberry vinaigrette.</description>
<price>7</price>
<url>summersalad.xml?id=1</url>
</menu_item>
<menu_item id="2">
<item>Thai Noodle Salad</item>
<description>lightly sauteed in sesame oil with baby bok choi, portobello mushrooms, and scallions.</description>
<price>8</price>
<url>thainoodles.xml</url>
</menu_item>
<menu_item id="3">
<item>Grilled Pacific Salmon</item>
<description>served with new potatoes, diced beets, Italian parlsey, and lemon zest.</description>
<price>16</price>
<url>salmon.xml</url>
</menu_item>
</specials>
summersalad.xml
<?xml version="1.0" encoding="UTF-8"?>
<item>
<item_name>Summer salad</item_name>
<ingredients>
<ingredient>
<name>butter lettuce</name>
</ingredient>
<ingredient>
<name>Macintosh 苹果</name>
</ingredient>
<ingredient>
<name>Blood oranges</name>
</ingredient>
<ingredient>
<name>Gorgonzola cheese</name>
</ingredient>
</ingredients>
</item>
<item>
<item_name>Summer salad</item_name>
<ingredients>
<ingredient>
<name>butter lettuce</name>
</ingredient>
<ingredient>
<name>Macintosh 苹果</name>
</ingredient>
<ingredient>
<name>Blood oranges</name>
</ingredient>
<ingredient>
<name>Gorgonzola cheese</name>
</ingredient>
</ingredients>
</item>
thainoodles.xml
<?xml version="1.0" encoding="UTF-8"?>
<item>
<item_name>Thain Noodles</item_name>
<ingredients>
<ingredient>
<name>Thain Noodle</name>
</ingredient>
<ingredient>
<name>Macintosh apples</name>
</ingredient>
</ingredients>
</item>
<item>
<item_name>Thain Noodles</item_name>
<ingredients>
<ingredient>
<name>Thain Noodle</name>
</ingredient>
<ingredient>
<name>Macintosh apples</name>
</ingredient>
</ingredients>
</item>
salmon.xml
<?xml version="1.0" encoding="UTF-8"?>
<item>
<item_name>Salmon</item_name>
<ingredients>
<ingredient>
<name>Salmon</name>
</ingredient>
<ingredient>
<name>parsley</name>
</ingredient>
<ingredient>
<name>basil</name>
</ingredient>
</ingredients>
</item>
<item>
<item_name>Salmon</item_name>
<ingredients>
<ingredient>
<name>Salmon</name>
</ingredient>
<ingredient>
<name>parsley</name>
</ingredient>
<ingredient>
<name>basil</name>
</ingredient>
</ingredients>
</item>
- Spry学习(二)----XML数据集及主从表显示
- Spry学习(一)----XML数据集及显示
- Spry学习(三)----XML数据集排序
- Spry学习(四)----数据集过滤及淡入淡出效果
- spry动态数据集
- datagrid 显示主从表数据
- (AJAX学习二) XHR及JQuery处理XML数据
- Spry学习(五)----框架结构
- XML数据岛主从表的建立
- TensorFlow 学习(二) 制作自己的TFRecord数据集,读取,显示及代码详解
- TensorFlow学习笔记(二十四)自制TFRecord数据集 读取、显示及代码详解
- Struts+Hibernate显示主从表数据
- spry
- Android学习之ListView显示XML数据
- XML 数据岛之二数据分页显示
- GridView模版列嵌套GirdView显示主从表数据
- GridView模版列嵌套GirdView显示主从表数据
- GridView模版列嵌套GirdView显示主从表数据
- 获取datagrid中光标所在行的某列的值
- Spry学习(一)----XML数据集及显示
- 在Tomcat上配置struts2环境时遇到 “Error filterstart” 问题的解决方法
- 不知道写什么了
- Asp.net 2.0 用C# 创建 PDF文件[引用] (示例代码下载)
- Spry学习(二)----XML数据集及主从表显示
- 牛刀小试---浅谈Spring如何整合WEB应用程序,Ibatis(2)!
- Win32 API函数
- Java 视频捕获(JMF)
- 重启机器/待机/睡眠等状态
- Linux kernel coding style (Linux内核编码风格)
- Excel文件
- C++实现插件构架 之 入门篇
- Java性能优化技巧集锦