反饋已提交

網絡繁忙

當前為10.0版本文檔,更多實例內容將在最新幫助文檔中展現,點選跳轉至 最新版幫助文檔

自定义提交按钮

1. 概述

1.1 问题描述

在我们使用填报表时,有时只需要提交按钮将数据入库,不希望使用 FR 内置的工具栏的按钮,希望能够自定义提交按钮。
自定义按钮既可以是 FineReport 模板中添加的按钮控件,也可以是 Web 集成页面中,HTML 的按钮标签。
(1)FineReport 模板中的按钮控件实现自定义提交操作详细请参照 自定义按钮中实现提交操作
(2)而在 Web 页面中,点击 HTML 中的按钮提交 iframe 中的 FineReport 报表就在下面详述。

效果如下图:

222

1.2 实现思路

FR 中内置的报表提交 JS 代码是contentPane.writeReport(),如果是调用嵌入的报表提交功能的话,使用document.getElementById('报表所在iframe的id').contentWindow.contentPane.writeReport();

2. 操作步骤

2.1 编辑模板

使用模板%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc\Form\FreeFrom\FreeForm.cpt

2.2 编辑 HTML 代码

在网页中添加按钮代码如下:

<button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.writeReport()">提交</button>

完整代码:


<html>     
<head>     
<title>自定义提交按钮</title>   
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
</head>     
<body>     
<div id="toolbar">     
<button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.writeReport()">提交</button>
</div>     
<iframe id="reportFrame" onload="afterload()" src="/webroot/decision/view/report?viewlet=doc/Form/FreeFrom/FreeForm.cpt&op=write&__showtoolbar__=false" width = 100% height = 80%></iframe>     
</body>     
</html> 

已完成示例请参照%FR_HOME%\webapps\webroot\help\page_demo\write.html


2.3 效果预览

启动设计器,在浏览器输入:http://localhost:8075/webroot/help/page_demo/write.html,效果如下图:

3. 已完成模板

已完成页面请查看%FR_HOME%/webapps/webroot/help/page_demo/write.html

点击下载页面

write.html


附件列表


主題: 原简体文档
已經是第一篇
已經是最後一篇
  • 有幫助
  • 沒幫助
  • 只是瀏覽
  • 圖片不清晰
  • 用語看不懂
  • 功能說明看不懂
  • 操作說明太簡單
  • 內容有錯誤

文 檔回 饋

滑鼠選中內容,快速回饋問題

滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

不再提示

10s後關閉