aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/menu/tablemenu.html
blob: 19691c6149cde768e1bf22e5898c30c9d93cb777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!doctype html>
<html>
<head>
	<title>Menu Visual Test: Default</title>
	<link rel="stylesheet" href="../visual.css" type="text/css" />
	<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
	<script type="text/javascript" src="../../../jquery-1.7.2.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
	<script type="text/javascript">
	$(function() {
		var table = $("table");
		var colgroup = table.find("colgroup");
		var menu = $("<ul>").insertAfter(table);
		var thead = table.find("thead");
		thead.children("tr").addClass("ui-state-default");
		var rows = table.find("tbody tr");
		$("<table>").width("100%").append(colgroup.clone()).append(thead).wrap("<li>").parent().appendTo(menu);
		rows.each(function() {
			$("<table>").width("100%").append(colgroup.clone()).append(this).wrap("<li><a></a></li>").parent().parent().appendTo(menu);
		});
		
		menu.menu({
			select: function(event, ui) {
				$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
			}
		});
	});
	</script>
	<style>
		body { font-size:62.5%; }
		.ui-menu { width: 200px; }
	</style>
</head>
<body>
	
<table>
	<colgroup><col style="width: 50%"><col style="width: 50%"></colgroup>
	<thead>
		<tr>
			<th>Firstname</th>
			<th>Lastname</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>Scott</td>
			<td>Gonzo</td>
		</tr>
		<tr>
			<td>Richy</td>
			<td>Worth</td>
		</tr>
	</tbody>
</table>
	
<div class="ui-widget" style="clear: left; margin-top:2em; font-family:Arial">
	Log:
	<div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>

<button id="toggle-disable">Disable / Enable</button>
<button id="toggle-destroy">Destroy / Create</button>

</body>
</html>