JS Change the Background Color of a Clicked Row

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

    1.1 Requirement

    In the Preview mode, a large number of data will be displayed. How to highlight a table row on click?

     


    1.2 Solution

    Add a Loading End event to the template and set the color of a clicked table row to red 

    II. Samples

    2.1 Sample 1: Highlight a table row on click

    2.1.1 Add an event

    Click [Template] >[Web Attributes] >[Pagination Preview], check [Individually set for the template], and add a Loading End event, as shown in the figure below:

     

    Input the following JavaScript codes:

    contentPane.makeHighlight('red');

     

    2.1.2 Preview

    Save the template and click [Pagination Preview]. The preview effect on a PC is shown as below:

     


    2.2 Sample 2: Highlight a table row on hover

    2.2.1 Add an event

    Click [Template] >[Web Attributes] >[Pagination Preview], check [Individually set for the template], and add a Loading End event, as shown in the figure below:

     

    Input the following JavaScript codes:

    contentPane.makeHighlight('red','mouseover');

    2.2.2 Preview

    Save the template and click [Pagination Preview]. The preview effect on a PC is shown as below:

     

    III. Download the templates

    Template for Sample 1

    Mouseover.cpt


    Template for Sample 1

    Click.cpt



    Attachment List


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