-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintTable.html
More file actions
138 lines (126 loc) · 5.32 KB
/
printTable.html
File metadata and controls
138 lines (126 loc) · 5.32 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices-->
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Print Table</title>
<!--
<link rel="stylesheet" href="/dojo/1.9.3/dijit/themes/claro/claro.css"/>
-->
<link rel="stylesheet" href="https://apps.neotomadb.org/dojo/1.9.3/dijit/themes/claro/claro.css"/>
<style>
* {
outline: none !important;
}
body, html {
height: 100%;
margin: 0;
padding: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.claro {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: .8em; /*.9 is default?*/
color: #131313;
}
.title {
width: 500px;
font-size: 24pt;
margin: 10px 8px 0 8px;
}
table {
border-collapse:collapse;
margin: 8px;
}
table, td, th {
border: 1px solid black;
}
th {
font-size: 1.0em; /*.9 is default?*/
padding: 1px 2px 1px 2px;
background-color: lightgray;
text-align:left;
}
</style>
<script>
dojoConfig = {
isDebug: 1,
async: 1
};
</script>
<!--<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojo/dojo.js"></script>
<script src="/dojo/1.9.3/dojo/dojo.js"></script>-->
<script src="http://apps.neotomadb.org/dojo/1.9.3/dojo/dojo.js"></script>
<script>
try {
require(["dojo/parser", "dijit/layout/ContentPane", "dijit/form/CheckBox", "dijit/form/Button", "dijit/form/TextBox", "dijit/InlineEditBox", "dojo/domReady!"],
function (parser) {
try {
parser.parse();
} catch (e) {
alert("Error in parsing function in printTable.html: " + e.message)
}
}
);
} catch(e) {
alert("error in js in printTable.html: " + e.message);
}
function loaded() {
require(["dijit/registry", "dojo/dom-construct", "dojo/_base/array", "dojo/dom", "dojo/dom-class"],
function (registry, domConstruct, array, dom, domClass) {
if (window.opener) {
try {
//alert("got opener");
//alert("# records: " + opener.printData.length);
//// add title
//if (title) {
// printTitle.set("value", title);
//}
// create table
//var table = domConstruct.create("table", { style: { overflow: "hidden" } });
var table = domConstruct.create("table");
var row = null;
// add class to table
//domClass.add(table, "printTable");
// create header row
row = domConstruct.create("tr", null, table);
var dataRow1 = opener.printData[0];
for (columnName in dataRow1) {
if (dataRow1.hasOwnProperty(columnName)) {
domConstruct.place(domConstruct.create("th", { innerHTML: columnName }), row);
}
}
// add all rows
array.forEach(opener.printData,
function (dataRow) {
row = domConstruct.create("tr", null, table);
for (columnName in dataRow) {
if (dataRow.hasOwnProperty(columnName)) {
domConstruct.place(domConstruct.create("td", { innerHTML: dataRow[columnName] }), row);
}
}
}
);
// add table to page
domConstruct.place(table, printTitle.domNode, "after");
} catch (e) {
alert("Error printing table: " + e.message);
}
} else {
alert("Can't find the Neotoma Explorer window to get the table data.");
}
}
);
}
//function print() {
// window.print();
//}
</script>
</head>
<body class="claro" onload="loaded();">
<div data-dojo-id="printTitle" class="title" data-dojo-type="dijit/InlineEditBox" data-dojo-props="editor:'dijit/form/TextBox', noValueIndicator:'Click to enter title'"></div>
</body>
</html>