カスタム書き込みボタン

  • 作成者:ayuan0625
  • 編集回数:20次
  • 最終更新:ayuan0625 于 2021-11-01
  • 一.概要

    1.応用シーン

    書き込み帳票を使用する際、FineReportに組み込まれたツールバーのボタンではなく、カスタマイズの書き込みボタンを利用してデータをDBに書き込みたい場合はこの応用シーンに該当します。

    2.機能紹介

    FineReportのテンプレートに追加されたボタンウィジェットでも、Web統合画面にあるHTMLのボタンラベルでもカスタムボタンとして利用できます。

    1.FineReportのテンプレートにあるボタンウィジェットを通じてカスタム書き込みを実現したい方は書き込みボタンカスタマイズご参照ください。

    2.Web画面の中でHTMLのボタンをクリックしてiframeのFineReport帳票を書き込むことについては、この文章で詳しく説明します。効果は下図通りです。

    3.実現のアイディア

    FineReportに組み込まれた帳票書き込みのJavaScript文はcontentPane.writeReport()です。もし埋め込みの帳票書き込み機能を呼び出すなら、構文はdocument.getElementById('iframeのid').contentWindow.contentPane.writeReport()となります。

    注:contentPaneコードについて、詳しくはcontentPaneをご参照ください。

    二.事例

    1.テンプレートを用意

    次のテンプレートを使います。demo\form\stuff.cpt

    2.HTMLファイルを新規作成

    1.write.htmlを新規作成します。内容が次の通りです。

    <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=demo/Form/stuff.cpt&op=write&__showtoolbar__=false" width = 100% height = 80%></iframe>    
    </body>    
    </html>


    2.下図のように、write.htmlを%FR_HOME%\webapps\webroot\help\page_demoに置きます。

    3.効果確認

    サーバを開き、ブラウザにhttp://localhost:8075/webroot/help/page_demo/write.htmlを入力すると、下図のようなページが表示されます。

    Attachment List


    Theme: FineReport ディプロイ統合
    • いいね
    • 良くない
    • 閲覧しただけ