贾斯珀报告:如何编译子报表(Jasper Reports: How to compile subreports)
我有一个独立的应用程序,其职责之一是采取* .jrxml文件的路径并编译它。
直到带有子报表的报表出现,其中主表的编译没有编译它的任何子项,导致子报表* .jasper文件在跟踪后面找不到,我可以毫无问题地做到这一点。
有什么办法可以
1)设置JasperCompileManager自动获取子报表?
2)获取包含在JasperDesign或JasperReport对象中的子报表的路径列表?
我无法直接访问jrxml文件,因此修改报告以适应编译方法不是一种选择,也不适用任何标准命名方案来推断哪些子报告属于哪些报告。
这里有一个类似的问题:
http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=40683
使用JRVisitor生成JRSubreport对象列表,但是没有解释如何使用它来获取子报表的路径,以便编译它并递归查找子报表的子报表,我无法弄清楚。
I have a standalone application, and one of its duties is to take the path of a *.jrxml file and compile it.
I can do this without problem until a report with a subreport comes up, where the compilation of the master does not compile any of its children, resulting in a subreport *.jasper file not found later down the track.
Is there any way to
1) Set the JasperCompileManager to automatically pick up subreports?
2) Get a list of paths to subreports contained within either a JasperDesign or JasperReport object?
I have no direct access to the jrxml files, so modifying the reports to suit the compile method is not an option, nor is applying any standard naming scheme to infer which subreports belong to which reports.
There is a similar problem here:
http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=40683
where a JRVisitor is used to produce a list of JRSubreport objects, however there is no explanation of how to use this to get a path to the subreport in order to compile it and recursively look for subreports of subreports, and I cant figure it out.
原文:https://stackoverflow.com/questions/10004800
最满意答案
使用
change
事件而不是click
。 也可以使用toggleClass
而不是首先检查元素是否具有使用hasClass
的类,然后添加/删除它。$("fieldset.radio label").change(function() { $("fieldset.radio label").removeClass("radioselect"); $(this).addClass("radioselect"); }); $("fieldset.check label").change(function(e) { $(this).toggleClass("checkselect"); });
body, a { background-color: #000; color: #fff; } div.fieldrow { clear: both; overflow: hidden; margin: 0 0 15px 0; } div.fieldrow > label { cursor: pointer; } div.fieldrow > label { width: 50%; float: left; padding-right: 15px; text-align: right; line-height: 10px; } form div.fieldrow > div, form div.fieldrow > fieldset > div { float: right; margin-left: 1%; } fieldset { border: 0; padding: 5px 0 0 0; } div.fieldrow > fieldset label { line-height: 1.7; } input { border: 1px solid #3f6e74; background: rgba(3, 32, 38, 0.5); } fieldset input[type=checkbox], fieldset input[type=radio] { position: absolute; left: -9999px; } fieldset label { font-size: 1rem; color: #fff; cursor: pointer; display: block; font-weight: normal; line-height: 1.5; margin-bottom: 0; } fieldset > div > div > label > input { float: left; margin-top: 6px; } fieldset > div > div > label > span { display: block; margin: 0 0 0 30px; position: relative; top: -2px; } fieldset > div > div { position: relative; } fieldset > div > div > label:before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; position: absolute; left: 2px; top: 3px; background-color: #032026; border: 1px solid #76cddb; } fieldset.radio label:before { border-radius: 8px; } fieldset.radio > div > div > label.radioselect:before { background-color: #76CDDB; } fieldset.check > div > div > label.checkselect:before { content: "\2713"; font-size: 28px; color: #76CDDB; text-align: center; line-height: 8px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div>Radio works:</div> <div class="fieldrow"> <fieldset class="radio"> <div> <div> <label> <input type="radio" value="1"> <span>Here is option one</span> </label> </div> <div> <label> <input type="radio" value="2"> <span>Here is option two</span> </label> </div> <div> <label> <input type="radio" value="3"> <span>Here is option three</span> </label> </div> </div> </fieldset> </div> <div>Checks do not:</div> <div class="fieldrow"> <fieldset class="check"> <div> <div> <label> <input type="checkbox" value=""> <span>I have read the <a href="#">terms & conditions</a>.</span> </label> </div> <div> <label> <input type="checkbox" value=""> <span>I want to receive cool news and promotions.</span> </label> </div> </div> </fieldset> </div>
如果您可以更改HTML结构,则根本不需要JS复选框。
- 将复选框元素移出
label
- 将id添加到复选框,并将属性值添加到相应的
label
- 使用
:checked
属性和相邻的兄弟CSS选择器为选中的复选框设置样式$("fieldset.radio label").change(function() { $("fieldset.radio label").removeClass("radioselect"); $(this).addClass("radioselect"); });
body, a { background-color: #000; color: #fff; } div.fieldrow { clear: both; overflow: hidden; margin: 0 0 15px 0; } div.fieldrow > label { cursor: pointer; } div.fieldrow > label { width: 50%; float: left; padding-right: 15px; text-align: right; line-height: 10px; } form div.fieldrow > div, form div.fieldrow > fieldset > div { float: right; margin-left: 1%; } fieldset { border: 0; padding: 5px 0 0 0; } div.fieldrow > fieldset label { line-height: 1.7; } input { border: 1px solid #3f6e74; background: rgba(3, 32, 38, 0.5); } fieldset input[type=checkbox], fieldset input[type=radio] { position: absolute; left: -9999px; } fieldset label { font-size: 1rem; color: #fff; cursor: pointer; display: block; font-weight: normal; line-height: 1.5; margin-bottom: 0; } fieldset > div > div > label > input { float: left; margin-top: 6px; } fieldset > div > div > label > span { display: block; margin: 0 0 0 30px; position: relative; top: -2px; } fieldset > div > div { position: relative; } fieldset > div > div > label:before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; position: absolute; left: 2px; top: 3px; background-color: #032026; border: 1px solid #76cddb; } fieldset.radio label:before { border-radius: 8px; } fieldset.radio > div > div > label.radioselect:before { background-color: #76CDDB; } fieldset.check > div > div >:checked + label:before { /* Use :checked and adjacent sibling properties here*/ content: "\2713"; font-size: 28px; color: #76CDDB; text-align: center; line-height: 8px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div>Radio works:</div> <div class="fieldrow"> <fieldset class="radio"> <div> <div> <label> <input type="radio" value="1"> <span>Here is option one</span> </label> </div> <div> <label> <input type="radio" value="2"> <span>Here is option two</span> </label> </div> <div> <label> <input type="radio" value="3"> <span>Here is option three</span> </label> </div> </div> </fieldset> </div> <div>Checks do not:</div> <div class="fieldrow"> <fieldset class="check"> <div> <div> <input id="1c" type="checkbox" value=""> <!-- Move it out of label --> <label for="1c"> <!-- Add for with the corresponding checkbox id --> <span>I have read the <a href="#">terms & conditions</a>.</span> </label> </div> <div> <input id="2c" type="checkbox" value=""> <!-- Move it out of label --> <label for="2c"> <!-- Add for with the corresponding checkbox id --> <span>I want to receive cool news and promotions.</span> </label> </div> </div> </fieldset> </div>
Use
change
event instead ofclick
. Also usetoggleClass
instead of first checking if the element have a class usinghasClass
and then adding/removing it.$("fieldset.radio label").change(function() { $("fieldset.radio label").removeClass("radioselect"); $(this).addClass("radioselect"); }); $("fieldset.check label").change(function(e) { $(this).toggleClass("checkselect"); });
body, a { background-color: #000; color: #fff; } div.fieldrow { clear: both; overflow: hidden; margin: 0 0 15px 0; } div.fieldrow > label { cursor: pointer; } div.fieldrow > label { width: 50%; float: left; padding-right: 15px; text-align: right; line-height: 10px; } form div.fieldrow > div, form div.fieldrow > fieldset > div { float: right; margin-left: 1%; } fieldset { border: 0; padding: 5px 0 0 0; } div.fieldrow > fieldset label { line-height: 1.7; } input { border: 1px solid #3f6e74; background: rgba(3, 32, 38, 0.5); } fieldset input[type=checkbox], fieldset input[type=radio] { position: absolute; left: -9999px; } fieldset label { font-size: 1rem; color: #fff; cursor: pointer; display: block; font-weight: normal; line-height: 1.5; margin-bottom: 0; } fieldset > div > div > label > input { float: left; margin-top: 6px; } fieldset > div > div > label > span { display: block; margin: 0 0 0 30px; position: relative; top: -2px; } fieldset > div > div { position: relative; } fieldset > div > div > label:before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; position: absolute; left: 2px; top: 3px; background-color: #032026; border: 1px solid #76cddb; } fieldset.radio label:before { border-radius: 8px; } fieldset.radio > div > div > label.radioselect:before { background-color: #76CDDB; } fieldset.check > div > div > label.checkselect:before { content: "\2713"; font-size: 28px; color: #76CDDB; text-align: center; line-height: 8px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div>Radio works:</div> <div class="fieldrow"> <fieldset class="radio"> <div> <div> <label> <input type="radio" value="1"> <span>Here is option one</span> </label> </div> <div> <label> <input type="radio" value="2"> <span>Here is option two</span> </label> </div> <div> <label> <input type="radio" value="3"> <span>Here is option three</span> </label> </div> </div> </fieldset> </div> <div>Checks do not:</div> <div class="fieldrow"> <fieldset class="check"> <div> <div> <label> <input type="checkbox" value=""> <span>I have read the <a href="#">terms & conditions</a>.</span> </label> </div> <div> <label> <input type="checkbox" value=""> <span>I want to receive cool news and promotions.</span> </label> </div> </div> </fieldset> </div>
If you can change the HTML structure, you don't need JS at all for checkbox.
- Move the checkbox element out of the
label
- Add id to the checkbox and same as
for
attribute value to the correspondinglabel
- Use
:checked
property and adjacent sibling CSS selector to set styles for the checked checkbox$("fieldset.radio label").change(function() { $("fieldset.radio label").removeClass("radioselect"); $(this).addClass("radioselect"); });
body, a { background-color: #000; color: #fff; } div.fieldrow { clear: both; overflow: hidden; margin: 0 0 15px 0; } div.fieldrow > label { cursor: pointer; } div.fieldrow > label { width: 50%; float: left; padding-right: 15px; text-align: right; line-height: 10px; } form div.fieldrow > div, form div.fieldrow > fieldset > div { float: right; margin-left: 1%; } fieldset { border: 0; padding: 5px 0 0 0; } div.fieldrow > fieldset label { line-height: 1.7; } input { border: 1px solid #3f6e74; background: rgba(3, 32, 38, 0.5); } fieldset input[type=checkbox], fieldset input[type=radio] { position: absolute; left: -9999px; } fieldset label { font-size: 1rem; color: #fff; cursor: pointer; display: block; font-weight: normal; line-height: 1.5; margin-bottom: 0; } fieldset > div > div > label > input { float: left; margin-top: 6px; } fieldset > div > div > label > span { display: block; margin: 0 0 0 30px; position: relative; top: -2px; } fieldset > div > div { position: relative; } fieldset > div > div > label:before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; position: absolute; left: 2px; top: 3px; background-color: #032026; border: 1px solid #76cddb; } fieldset.radio label:before { border-radius: 8px; } fieldset.radio > div > div > label.radioselect:before { background-color: #76CDDB; } fieldset.check > div > div >:checked + label:before { /* Use :checked and adjacent sibling properties here*/ content: "\2713"; font-size: 28px; color: #76CDDB; text-align: center; line-height: 8px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div>Radio works:</div> <div class="fieldrow"> <fieldset class="radio"> <div> <div> <label> <input type="radio" value="1"> <span>Here is option one</span> </label> </div> <div> <label> <input type="radio" value="2"> <span>Here is option two</span> </label> </div> <div> <label> <input type="radio" value="3"> <span>Here is option three</span> </label> </div> </div> </fieldset> </div> <div>Checks do not:</div> <div class="fieldrow"> <fieldset class="check"> <div> <div> <input id="1c" type="checkbox" value=""> <!-- Move it out of label --> <label for="1c"> <!-- Add for with the corresponding checkbox id --> <span>I have read the <a href="#">terms & conditions</a>.</span> </label> </div> <div> <input id="2c" type="checkbox" value=""> <!-- Move it out of label --> <label for="2c"> <!-- Add for with the corresponding checkbox id --> <span>I want to receive cool news and promotions.</span> </label> </div> </div> </fieldset> </div>
相关问答
更多-
jquery mobile 页面跳转第二次不刷新怎么办[2022-09-17]
checkbox -
jquery mobile本地和环境中显示问题[2023-06-25]
checkbox -
jquery mobile 点击跳转不加载数据怎么回事[2023-11-26]
checkbox -
jQuery Mobile框架弹窗中放表单文本框,整个弹窗区域都会变为文本框的触发焦点,不想这样[2022-03-02]
checkbox -
如何在 jQuery Mobile 的 Listview 中动态移除某一条的图标[2023-09-01]
checkbox -
使用change事件而不是click 。 也可以使用toggleClass而不是首先检查元素是否具有使用hasClass的类,然后添加/删除它。 演示 $("fieldset.radio label").change(function() { $("fieldset.radio label").removeClass("radioselect"); $(this).addClass("radioselect"); }); $("fieldset.check label").change( ...
-
使用jquery切换复选框(toggle checkbox using jquery)[2023-03-21]
这太长了: checkboxes = document.getElementsByClassName(className); for(var i=0, n=checkboxes.length;ijQuery切换开关复选框 - 更改“已检查”属性延迟(jQuery toggle switch checkbox - changing “checked” attribute delay)[2023-01-30]
添加此项以加载添加/删除数组: // Onload remove array fill $("[type='checkbox']").each(function(){ if( $(this).is(":checked") ){ os_tagsToRemove.push($(this).attr("id")); }else{ os_tagsToAdd.push($(this).attr("id")); } }); 然后,你的逻辑全部逆转了。 首先,当您单击标签(定义for="an ...这应该有所帮助 基本解决方案 $(document).ready(function(){ $('input[type="checkbox"]').click(function(){ var item = $(this).attr('name'); $('input[name="'+item+'"][type="text"]').toggle(); }); }); 小提琴 可能更好? 如果你真的想使它高效,扩展jQuery $(document).ready( ...把它变成一个班级。 然后将click事件应用于该类。 $('.cart_option').on('click',function(){ $(this).toggleClass('active'); }); 编辑澄清:您仍然可以将独特的图像应用于cart_option_1 , cart_option_1b等等,但是click事件适用于所有,因为它们都具有关联的类。 Just make it a c ...相关文章
更多- Maven编译Hadoop的trunk项目报错:exec (compile-proto)
- JasperReport编译报表
- Hadoop-lzop-mater安装执行 ant compile-native tar 报错
- JasperReport报告查看和打印
- JasperReport填充报表
- storm源码编译
- Storm-0.9.2-incubating源代码编译打包
- JAVA 正则表达式教程(超详细)三(续)
- JasperReports报表区段(带区)
- JasperReport报表填充参数
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)