报表使用页签来展示报表列表如何用代码实现原创
431次浏览
编辑于2024年03月23日 11:05:16
@Override public void afterCreateNewData(EventObject e) { super.afterCreateNewData(e); this.getPageCache().put("tab","页签标识1");//设置页面缓存记录页签 ReportFilter filter = this.getView().getControl("reportfilterap");//初始自动查询 filter.search(); }
实现接口
TabSelectListener
@Override public void tabSelected(TabSelectEvent event) { //过滤条件配置 String subTabKey = event.getTabKey(); switch (subTabKey){ case "页签标识1": this.getPageCache().put("tab","页签标识1"); break; case "页签标识2": this.getPageCache().put("tab","页签标识2"); break; case "页签标识3": this.getPageCache().put("tab","页签标识3"); break; default: return; } ReportFilter filter = this.getView().getControl("reportfilterap");//切换页签时根据当前过滤条件自动查询 filter.search(); }
自定义触发时机,调用报表列表查询方法
@Override public void afterQuery(ReportQueryParam queryParam) { String tab = this.getPageCache().get("tab"); //根据切换标签查询 switch (tab){ case "页签标识1": queryReportList("报表列表标识1" , queryParam,null) ; break; case "页签标识2": queryReportList("报表列表标识2" , queryParam,null) ; break; case "页签标识3": queryReportList( "报表列表标识3" , queryParam,null); break; default: return; } }
private void queryReportList(String reportListap,ReportQueryParam queryParam,Object obj) { IReportCache cache = ReportCacheManager. getInstance() . getCache(); ReportList srcRpt = getControl(reportListap) ; //取到报表列表 ReportListModel model = (ReportListModel)srcRpt.getReportModel(); String pageId = model.getPageId( ); String ctrlId = reportListap; ReportTaskParam tp = new ReportTaskParam(); tp.setReportName("abc") ; //自定义设一个ReportName tp.setPluginClassName(srcRpt.getReportPluginClassName()); tp.setDataSource (srcRpt.getDataSource()); tp.setQueryDataSource(srcRpt. getDataSourceId()); tp.setOtherParam(queryParam); tp.setColumns(srcRpt.getColumns()); cache.setReportTaskParam (pageId,ctrlId,tp); srcRpt.submitTask(queryParam,obj); }
赞 0
0人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读