JS カスタム書き込みボタン

  • 作成者:ayuan0625
  • 編集回数:23次
  • 最終更新:FRInternational 于 2021-05-19
  • I. Overview

    1. Problem description

    If you define a custom button to implement some of your own business logic, but you also want this button to implement the submit and store operation, how to implement the FineReport submission in the custom button?


    2. Solution

    Add a click event to the custom button, and use the JS interface method provided by FineReport to implement the submit operation when the button is clicked. 

    II. Example

    1. Prepare template

    Open the built-in template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\RowForm\Simple_Row-based_Form.cpt

    Add a Button widget in cell B1, set the Button Type to "Common" and the Button Name to "Submit". As shown below:

    1.png



    2. Set click event

    Select cell B1, and add a Click event:

    2.png

     The JavaScript code is as follows:

    _g().verifyAndWriteReport();
    //Verify and submit

    The effect of this code is the same as clicking the submit button on the toolbar.


    3. Preview effect

    Save the template, click "Data Entry Preview", modify a piece of data at will, click the Submit button, and after the prompt "Success", preview the database query, you can see that the data is successfully filled in. As shown below:

    3.png

    III. Download template

    Click to download: 

    Custom_submit_button.cpt


    Attachment List


    Theme: FineReport データ書き込み
    • いいね
    • 良くない
    • 閲覧しただけ