forked from marianol/JasperEmbedSample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext-ic.html
More file actions
executable file
·230 lines (195 loc) · 7.21 KB
/
Copy pathcontext-ic.html
File metadata and controls
executable file
·230 lines (195 loc) · 7.21 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<!--
* ========================================================================
* context-ic.html
*
* ========================================================================
* Copyright 2013
* Author: Mariano Luna
*
* Unless you have purchased a commercial license agreement from Jaspersoft Inc., the following license terms apply:
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
* ======================================================================== */
-->
<html lang="en">
<head>
<title>Contextual Input Controls - JRS Embedded Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/require.js"></script>
<script src="http://localhost:8080/jasperserver-pro/bif/visualize.js"></script>
<script src="js/visualizeHelper.js"></script>
<script type="text/JavaScript">
var myReport;
var currentPageIndex = 0;
var maxPageIndex = 0;
function ReportFinishedCallback(status) {
// this function if is defined; is called by visualize helper runReport() when the report has finished.
$('#total').html(status.totalPages);
maxPageIndex = status.totalPages - 1;
$('#prev').hide();
if (currentPageIndex == maxPageIndex) {
$('#next').hide();
}
}
BIF.init({
domain: 'http://localhost:8080/jasperserver-pro',
mods: ['reports']
}, function(Reports) {
jsReportUnit = Reports;
initialize();
}
);
function initialize() {
var reportUri = '/public/Samples/Reports/ProfitDetailReport';
myReport = runReport(reportUri, 'report1');
myReport.rdy.then(function() {
myReport.getInputParameters().then(function() {
setupOptions(myReport.inputParameters);
$('#btn').click(function() {
$('#overlay').show();
myReport.run({
ProductFamily: $('#inputOptions').val()
});
});
});
});
/*
Setup page navigation buttons
*/
$('#next').on('click',function() {
currentPageIndex++;
$('#current').html(currentPageIndex+1);
myReport.gotoPage(currentPageIndex);
if (currentPageIndex == maxPageIndex) {
$('#next').hide();
$('#prev').show();
} else {
$('#prev').show();
$('#next').show();
}
});
$('#prev').on('click',function() {
currentPageIndex--;
$('#current').html(currentPageIndex+1);
myReport.gotoPage(currentPageIndex);
if (currentPageIndex == 0) {
$('#prev').hide();
$('#next').show();
} else {
$('#next').show();
$('#prev').show();
}
});
}
function setupOptions(inputParameters) {
$('#inputName').html(inputParameters[0].label);
$.each(inputParameters[0].state.options, function() {
$('#inputOptions').append('<option value="'+this.value+'">'+this.label+'</option>');
});
}
function passControls(paramValue) {
var myParameters;
myParameters = {
ProductFamily: paramValue
};
currentPageIndex = 0;
myReport.run(myParameters) ;
}
</script>
<style type="text/css">
#repo h3 {
padding: 5px 0;
margin: 0;
}
#repo table {
border-collapse: collapse;
}
#repo td {
border: solid 1px #eee;
padding: 4px 0;
}
.fill { top:20; right:0; bottom:0; left:0}
#overlay { background: #333; opacity: 0.33}
#ajax-icon { width:64px; height: 64px; margin:auto; color: #fff; text-align: center}
.mygrid-wrapper-div {
overflow: scroll;
height: 400px;
}
</style>
</head>
<body onLoad="">
<div class="navbar navbar-inverse navbar-static-top">
<div class="container" style="width:100%; ">
<a href="#" class="navbar-brand">Jaspersoft Portal</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="index.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Extra Samples <b class="caret"></b><a/>
<ul class="dropdown-menu">
<li><a href="context-ic.html">Contextual Input Controls</a></li>
<li><a href="reportInteraction.html">External Report Interaction</a></li>
<li><a href="reportInteraction2.html">Report Interaction</a></li>
<li><a href="reportPopup.html">Report Popup</a></li>
</ul>
</li>
<li><a href="http://github.com/marianol/JasperEmbedSample">About</a></li>
</ul>
</div>
</div>
</div>
<div class="container" style="width:100%; ">
<div class="row">
<div class="col-md-12">
<button id="buttonDrinks" onclick="passControls('Drink');" >Show Drinks Only</button>
</div>
</div>
<div class="row">
<div class="col-md-8">
<h3><a href="#">Profit Detail</a></h3>
<div id="report1" class="fill"></div>
<div id="pager">
<table>
<tr>
<td><button id="prev">Prev</button></td>
<td>Page <span id="current">1</span> / <span id="total"></span></td>
<td><button id="next">Next</button></td>
</tr>
</table>
</div>
<div id="ajax-icon" class="fill">
<i class="icon-spinner icon-spin icon-3x"></i>
<p>Loading...</p>
</div>
</div>
<div class="col-md-1">
</div>
<div class="col-md-3">
<h4>Select your filters</h4>
<p><strong> <span id="inputName"></span> :</strong></p>
<select multiple id="inputOptions"></select>
<button id="btn">Run Report</button>
</div>
</div>
</div>
</body>
</html>