Interlaced Color Change After Row Hiding

  • Last update:April 28, 2025
  • Overview

    Problem

    If you set the interlaced color change (setting the background color every other row/column) for a report, and set the conditional attribute to hide the row height for certain rows of the report, the effect of the interlaced color change may not be visually appealing. 

    For example, the following figure shows the effect of the interlaced color change after the rows with 1 as the Shipper values are hidden.

    How to retain the interlaced color change effect after the row hiding?

    Solution

    Method one: You can use the IF() formula when setting the background color to set the hidden rows not to be involved in the interlaced color change operation.

    Method two: You can add a Loading End event under Template > Web Attribute > Pagination Preview Setting to achieve the effect by JavaScript code. 

    Example

    Template Preparation

    Open the template Interlaced Color Change After Row Hiding in %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Primary\Interlaced Color Change After Row Hiding.cpt.

    Row Hiding

    Select cell E2, and add the condition to set the row height to 0 when the Shipper value equals to 1. Select Row Height from the drop-down list of Attribute, select Common as Type, set the condition Equal to 1 (String), and click Add. The following figure shows the steps.

     隔行变色2.png

    Method One: Setting the Background Color

    Select cell A2, choose Condition Attribute > Background, and modify the formula to IF(E2!=1,SEQ()%2=0,FALSE).

     隔行变色3.png

    Method Two: Loading End Event Adding

    1. Delete the former condition attribute of cell A2 after the row hiding setting.

    2. Choose Template > Web Attribute > Pagination Preview Setting, and select Set for This Template Separately in Following Settings. Click the Add icon at the bottom of the page, select Loading End, and enter the following JavaScript code in the pop-up event setting dialog box.

    $(".x-table tr:visible").each(function(i) {

    if (i % 2 == 0 && i >= 1) {

    $(this).css("background-color", "#ccccfd");

    }

    });

    iconNote: 
    In the code, 1 refers to the result of subtracting one from the row number of the row where the cell starting to change color is located. 

    The following figure shows the steps.

     隔行变色4.png

    Effect Display

    PC 

    Save the report and click Pagination Preview. The following figure shows the preview effect.

    隔行变色5.png 

    Mobile Terminal

    Note that adding the Loading End event mentioned in method two is not supported on mobile terminals, and the method one operation is supported on both APP and H5 terminals. The following figure shows the effect.

     隔行8.jpg

    FRM Report Example-JS

    How to achieve the same effect in FRM reports by JS events?

    iconNote: 
    This method only applies to the FRM report of the old version instead of the FRM report of the new version. 

    Template Creation

    Create an FRM report, drag a report block into the report, and design the table in the report block as shown in the above template. Add the condition attribute mentioned above to cell E2, and do not set the condition attribute for cell A2.

     隔行变色6.png

    After Initialization Event Adding

    Select the report block, click Event on the right attribute panel, add an After Editing event, and enter the following JavaScript code:

    setTimeout(function() {

    $(".x-table tr:visible").each(function(i) {

    if (i % 2 == 0 && i >= 1) {

    $(this).css("background-color", "ccccfd");

    }

    });

    }, 1000);

    The following figure shows the steps.

    隔行变色7.png 

    Effect Display

    Save the report and click Pagination Preview. The following figure shows the preview effect.

    iconNote: 
    The effect cannot be previewed on mobile terminals. 

    隔行9.png

    Template Download

    Attachment List


    Theme: Report Features
    • 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