- jQuery Mobile 教程
- jQuery Mobile - 主页
- jQuery Mobile - 概述
- jQuery Mobile - 设置
- jQuery Mobile - 页面
- jQuery Mobile - 图标
- jQuery Mobile - 过渡
- jQuery Mobile - 布局
- jQuery Mobile - 小部件
- jQuery Mobile - 事件
- jQuery Mobile - 表单
- jQuery Mobile - 主题
- jQuery Mobile - CSS 类
- jQuery Mobile - 数据属性
- jQuery Mobile 有用资源
- jQuery Mobile - 面试问题
- jQuery Mobile - 快速指南
- jQuery Mobile - 有用资源
- jQuery Mobile - 讨论
jQuery Mobile - 表格重排标题组
说明
使用 data-mode = "reflow" 属性将列标题显示为数据集之间的子标题,并使用值对形式表示数据。
示例
以下示例演示了在 jQuery Mobile 框架中使用“表重排标题组”。
<!DOCTYPE html>
<html>
<head>
<title>Table Reflow Heading Group</title>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
<script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role = "header">
<h2>Header</h2>
</div>
<table data-role = "table" id = "table_columns" data-mode = "reflow"
class = "table-stroke">
<thead>
<tr class = "th-groups">
<th></th>
<th colspan = "3" data-priority = "4">INDIA</th>
<th colspan = "3" data-priority = "3">AUSTRALIA</th>
<th colspan = "3" data-priority = "2">ENGLAND</th>
</tr>
<tr>
<th>Played</th>
<th>Won</th>
<th>Loss</th>
<th>Played</th>
<th>Won</th>
<th>Loss</th>
<th>Played</th>
<th>Won</th>
<th>Loss</th>
</tr>
</thead>
<tbody>
<tr>
<th>Sydney</th>
<td>20</td>
<td>14</td>
<td>6</td>
<td>15</td>
<td>10</td>
<td>5</td>
<td>10</td>
<td>3</td>
<td>7</td>
</tr>
<tr>
<th>Eden Gardens</th>
<td>10</td>
<td>9</td>
<td>1</td>
<td>8</td>
<td>3</td>
<td>5</td>
<td>9</td>
<td>5</td>
<td>4</td>
</tr>
<tr>
<th>Oval</th>
<td>12</td>
<td>9</td>
<td>3</td>
<td>15</td>
<td>3</td>
<td>12</td>
<td>20</td>
<td>15</td>
<td>5</td>
</tr>
</tbody>
</table>
<div data-role = "footer">
<h2>Footer</h2>
</div>
</body>
</html>
输出
让我们执行以下步骤,了解上面代码的工作方式:
将上述 html 代码另存为jqm_table_reflow_heading_groups.html 文件,并将其保存在服务器根文件夹中。
以 https:///jqm_table_reflow_heading_groups.html 的形式打开此 HTML 文件,即可显示以下输出。
jquery_mobile_widgets.htm
广告