Change the Background of a Cell in the Row Where the Checkbox is Located

  • Last update:  2020-12-30
  • I. Overview

    1.1 Problem description

    When filling a form, after checking the checkbox, change the background color of a cell in the row where the checkbox is located.

    3.png


    1.2 Implementation ideas

    Add a State Change event to the checkbox widget to change the background color of the specified cell.

    II. Example

    2.1 Open the report

    Open the report %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\data entry\batch deletion.cpt.

     

    2.2 Modify the report

    Right-click A3, clear the original widget in the cell, and set the left parent cell of cell B7 to C7.

    1.png

    Set the widget for A3, select the checkbox widget as the widget type, add a State Change, add a parameter named row and the parameter value is the formula: row(), as shown in the following figure:

    Snag_fa9b922.png

    JS code:

    var value = this.getValue();
    if(value)
    {
    $('td[id^=H'+row+'-0-0]').css({'background-color':'yellow'});//When the checkbox is checked, in the current row, the background color of the cell in column H turns yellow
    }
    if(!value)
    {
    $('td[id^=H'+row+'-0-0]').css({'background-color':'white'});//When the check box is not checked, in the current row, the background color of the cell in column H becomes white
    }

    Note: When there are horizontally expanded data columns in the report, please note that the H in $('td[id^=H'+row+'-0-0]') is column H after expansion during the preview rather than column H in the designer.

     

    2.3 Preview effect

    Save the template, click Data Entry Preview, and the effect on the PC side is as follows:

    3 (1).png

    Note: The JS codes doe not support mobile devices.

    III. Completed Template

    Attachment List


    Theme: Data Entry
    • Helpful
    • Not helpful
    • Only read

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

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

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy