JS 編集時の文字の色を変える

  • 作成者:ayuan0625
  • 編集回数:6次
  • 最終更新:ayuan0625 于 2020-12-16
  • I. Overview

    1.1 Problem

    Many report designs use dark colors as the background. Although the font can be set to light colors, the font is still black when in edit mode:

    1.gif


    1.2 Solution

    Add the pre-editing event of the widget , write JS to change the font color.

    Note: This function does not support mobile devices.

    2.gif

    II. Example

    2.1 Report design

    Design the table as shown below, add [Text Field Widget] to cell A2, and add [Text Area Widget] to cell B2.

    3.png


    2.2 Add JS event

    Select cell A2, click the [Event] tab, and add a [Before Editing] event to the text widget.

    Add the following JavaScript:

    $("input").css("color","white");

    4.png

    Select cell B2 , click the [Event] tab, and add a [Before Editing] event to the text field widget.

    Add the following JavaScript:

    $("textarea").css("color","white");

    5.png


    2.3 Preview effect

    Save and click [Data Entry Preview]:

    6.gif

    III. Download template

    Attachment List


    Theme: FineReport カスタム開発
    • いいね
    • 良くない
    • 閲覧しただけ