AUTHOR: Stephania Tapela
DATE POSTED: March 10, 2017
Article information
Article relates to
Telerik Reporting
Created by
Stef, Telerik
Last modified
March 10, 2017
Last modified by
<script type=
"text/javascript"
>
$(document).ready(
function
() {
$(
"#reportViewer1"
)
.telerik_ReportViewer({
// The URL of the service which will serve reports.
serviceUrl:
"/api/reports"
,
//ReportSource - string description of the report we want from the server
reportSource: { report:
"SampleReport.trdp"
},
// Specifies whether the viewer is in interactive or print preview mode.
viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
// Sets the scale mode of the viewer.
scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
// Zoom in and out the report using the scale
scale: 1.0,
//the custom parameter editor
parameterEditors: [
{
match:
(parameter) {
return
parameter.type ===
"System.DateTime"
;
createEditor:
(placeholder, options) {
$(placeholder).html(
'<input type="datetime"/>'
);
var
dateTimePicker = $(placeholder),
parameter,
valueChangedCallback = options.parameterChanged,
dropDownList;
onChange() {
dtv =
this
.value();
if
(
null
!== dtv) {
dtv = myadjustTimezone(dtv);
}
valueChangedCallback(parameter, dtv);
beginEdit:
(param) {
parameter = param;
dt =
try
(param.value) {
dt = myunadjustTimezone(param.value);
catch
(e) {
//you can configure the widget
$(dateTimePicker).find(
"input"
).kendoDateTimePicker({
format:
"dd/MM/yyyy hh:mm:ss"
min:
new
Date(2014, 0, 1, 8, 0, 0),
max:
Date(2018, 0, 4, 22, 0, 0),
change: onChange,
value: dt
});
dropDownList = $(dateTimePicker).find(
).data(
"kendoDateTimePicker"
}]
//functions required for adjusting the Date and Time selection to avoid sending and receiving dates, which are not in UTC
myadjustTimezone(date) {
Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
};
myunadjustTimezone(date) {
Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
</script>
Resources Buy Try