在 BIRT 中添加日期选择器作为参数 [英] Adding date picker as parameter in BIRT

查看:32
本文介绍了在 BIRT 中添加日期选择器作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为 Eclipse 报告中的日期参数添加日期选择器时遇到了一些挑战.我对 Javascript 知之甚少或一无所知......我希望能得到一些关于如何实现这一点的详细说明.谢谢.

I am having some challenges adding a date picker for my date parameter in an Eclipse report. I have little or no knowledge of Javascript ... I would appreciate some detailed instruction on how to accomplish this. Thanks.

推荐答案

有一种方法可以实现这一点,但不是直截了当的.

There is a way to achieve this, but it is not straight forward.

方法如下

  1. 首先您需要下载 jscal2 项目文件.您将在下面提到的 Github 项目中找到所需的文件.

  1. First you need to download the jscal2 project files.You will find the required files in the below mentioned Github project.

https://github.com/captainhcg/GFW/tree/master/js/JSCal2-1.9

在您的项目中找到位于

In your project find "FramesetFragment.jsp" file located in the location

birt/webcontent/birt/pages/layout/FramesetFragment.jsp

birt/webcontent/birt/pages/layout/FramesetFragment.jsp

如果您已经启动并运行了 birt 报告,则该文件应该在您当前的项目设置中随时可用.(我不打算在这里解释 JAVAEE web 项目中的 birt 报告配置,因为这只是关于如何为现有的 birt 报告日期参数字段添加日期选择器.)

This file should be readily available in your current project setup, if you already have birt report up and running. (I am not going to explain birt report configuration in a JAVAEE web project here, because this is only about how to add the datepicker for existing birt report date parameter field.)

在FramesetFragment.jsp"文件的第 130 行之后(在 </HEAD> 标签之前)添加以下代码行.将上下文根路径替换为您的项目上下文根.

Add the following lines of code after line number 130(before the </HEAD> tag) of "FramesetFragment.jsp" file. Replace the context root path with your project context root.

<script src="${pageContext.request.contextPath}/js/jscal2.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/lang/en.js" type="text/javascript"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/border-radius.css" meda="screen" type="text/css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/jscal2.css" meda="screen" type="text/css"/>

  1. 将相关文件(4个文件)添加到项目中的指定位置

  1. Add the relevant files(4 files) into specified locations in your project

4.1 将 jscal2.js 和 en.js 文件添加到项目中的 javascript 文件位置.

4.1 Add both jscal2.js and en.js files into javascript file location in your project.

你的webcontextroot/js/jscal2.js

yourwebcontextroot/js/lang/en.js (* 至少需要一个语言文件)

yourwebcontextroot/js/lang/en.js (* At least one language file is required)

4.2 将两个样式表添加到相关位置.

4.2 Add both style sheets to relevant locations.

yourwebcontextroot/css/border-radius.css

yourwebcontextroot/css/jscal2.css

找到位于

"birt/webcontent/birt/pages/parameter/TextBoxParameterFragment.jsp"

"birt/webcontent/birt/pages/parameter/TextBoxParameterFragment.jsp"

  • 在TextBoxParameterFragment.jsp"文件的最后一个表格数据和表格行结束标记之前添加以下代码.

  • Add the following code just before the last table data and table row end tags of "TextBoxParameterFragment.jsp" file.

    <%
    if (parameterBean.getParameter().getDataType()==7|| parameterBean.getParameter().getDataType()==4) {
    %>
    
    <button id="<%=parameterBean.getName()%>_button">...</button>
    <script type="text/javascript">
        Calendar.setup({
            trigger    : '<%=parameterBean.getName()%>_button',
            inputField : '<%=parameterBean.getName()%>',
                    onSelect   : function() { this.hide() }
        });
    </script>
    
    
    <%
    }
    %>
     </TD>`<!-- Last table data end tag -->`
    </TR>`<!-- Last table row end tag -->`

    1. 仅此而已.重新部署您的项目.打开一个新的浏览器窗口并转到您的一份报告.

    1. Thats all. Redeploy your project.Open a new browser window and go to one of your reports.

    您应该会在日期字段旁边看到一个按钮,单击它后,您将看到一个日期选择器窗口.

    You should see a button next to date fields and once you clicked on it, you will get a datepicker window.

    注意:

    FramesetFragment.jsp"和TextBoxParameterFragment.jsp"文件可以在您的项目中的不同位置.

    Both "FramesetFragment.jsp" and "TextBoxParameterFragment.jsp" files could be in different locations in your project.

    这篇关于在 BIRT 中添加日期选择器作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆