简体   繁体   English

如何在BIRT中包含jQuery库

[英]How do I include jQuery library in BIRT

I'm trying to include jQuery library in BIRT report, I tried two ways: 我试图在BIRT报告中包含jQuery库,我尝试了两种方法:

  1. I tried to use an text element which properties is HTML and dynamic text in the report, and I copied jQuery.js code into the <script></script> snippet, it does work for few simple operations, but it does not work as jQuery should 我试图在报告中使用一个文本元素,其中属性是HTML和动态文本,我将jQuery.js代码复制到<script></script>片段中,它确实适用于一些简单的操作,但它不起作用jQuery应该
  2. So I suspect that it should be included in the <head> tag, and then I modified the below files: 所以我怀疑它应该包含在<head>标签中,然后我修改了下面的文件:

    birt/webcontent/birt/pages/layout\\FramesetFragment.jsp birt/webcontent/birt/pages/layout\\RequesterFragment.jsp birt/webcontent/birt/pages/layout\\RunFragment.jsp birt/webcontent/birt/pages/layout\\FramesetFragment.jsp birt/webcontent/birt/pages/layout\\RequesterFragment.jsp birt/webcontent/birt/pages/layout\\RunFragment.jsp

to include jquery.js , but it doesn't work either 包括jquery.js ,但它也不起作用

Any idea? 任何想法?

I've done this two different ways. 我已经完成了两种不同的方式。

The first and easiest is to include an html text element at the top of your report so it's read first with a pointer to your jquery library: 第一个也是最简单的是在报表的顶部包含一个html文本元素,因此首先使用指向jquery库的指针读取它:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

This is still in the BODY of your page, but as long as it's up above everything else, it should still be read first. 这仍然在您页面的BODY中,但只要它高于其他所有内容,它仍应首先被读取。

The second way is to use a modified HTML emitter that allows you to add elements to the HEAD portion of your HTML page. 第二种方法是使用修改后的HTML发射器,允许您将元素添加到HTML页面的HEAD部分。 This is available here and was written by johnw. 这可以在这里找到 ,由约翰写的。 It requires you to modify the jar files in your birt engine. 它要求您修改birt引擎中的jar文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM