Exclusive API for Date Widget

  • Last update:May 21, 2025
  • Version

    Version Functional Change
    11.0

    Difference from V10.0:

    Added the setMaxAndMinDate and setPopupStyle APIs.

    11.0.16 

    The setMaxAndMinDate API is supported in FineReport with the FineVis  Data Visualization plugin of V2.1.0 and later versions.

    Before API use, read JS API Compatibility Description carefully. APIs are supported in both general reports and dashboards (new version) by default.

    setMaxAndMinDate

    APIsetMaxAndMinDate(Date) To set the selectable date range of the date widget.
         Parameter 

    Date:

    {

        max: string | Date;

        min: string | Date;

    }

    Start date and end date (in JSON format).

    max: End date, which can be a string or a date in the yyyy-mm-dd HH:mm:ss format.

    min: Start date, which can be a string or a date in the yyyy-mm-dd HH:mm:ss format.

     Returned Valuevoid
         Example 

    Example 1: You can set the selectable date range to 2021-09-01 to 2021-09-08 when the obtained date widget object is defined as dateEditor.

    dateEditor.setMaxAndMinDate({

        min: "2021-09-01",

        max: "2021-09-08"

    });

    Example 2: In a general report, you can set the selectable range of the date widget dateEditor0 on the parameter panel to 2021-09-01 to 2021-09-08.

    _g().getParameterContainer().getWidgetByName("dateEditor0").setMaxAndMinDate({

        min: "2021-09-01",

        max: "2021-09-08"

    });

    Example 3: In a general report, you can set the selectable range of the date widget dateEditor0 in a data entry cell to 2021-09-01 to 2021-09-08.

    _g().getWidgetByName("dateEditor0").setMaxAndMinDate({

        min: "2021-09-01",

        max: "2021-09-08"

    });

    Example 4: In an FVS visualization dashboard, you can click the title to set the selectable range of the date widget to 2021-09-01 to 2021-09-08.

    duchamp.getWidgetByName("date").setMaxAndMinDate({

        min: "2021-09-01",

        max: "2021-09-08"

    });

    Example 5: In a dashboard, you can set the selectable range of the date widget dateEditor0 in body to 2021-09-01 to 2021-09-08.

    _g().getWidgetByName("dateEditor0").setMaxAndMinDate({

        min: "2021-09-01",

        max: "2021-09-08"

    });

    iconNote: 
    If an error occurs due to incomplete creation of the report block object after adding the event, you can add a delay function to postpone the execution.

    setTimeout(function(){

    _g().getParameterContainer().getWidgetByName("dateEditor0").setMaxAndMinDate({

        min: "2021-09-01",

        max: "2021-09-08"

    });

    }, 500);


      Application 

    Example 

    You can set the selectable range of the date widget dateEditor0 on the parameter panel to 2021-09-01 to 2021-09-08.

    For details, you can download the template Setting the Selectable Range of a Date Widget.cpt.

    FVS visualization dashboard: Setting the Selectable Range of Date Widget by JS.fvs.

    05.png

     Mobile Terminal  This API is supported on mobile terminals.

    setPopupStyle

    iconNote: 
    This API cannot be used in the FVS visualization dashboard.

    API setPopupStyle(PopupStyle)To set the pop-up box style for the date widget.
     Parameter 

    PopupStyle:

    {

        itemHeight: string;

        fontSize: string;

    }

    The style of the pop-up box, which is in JSON format.

    itemHeight: cell height in the pop-up box

    fontSize: font size of the dates in the pop-up box

    Returned Value    void
    Example Example 1: You can set the cell height to 10 px and font size to 10 px for the pop-up box when the obtained drop-down box widget object is defined as widget.
    widget.setPopupStyle({

        itemHeight: "10px",

        fontSize: "10px"

    });

    Example 2: You can get the date widget dateEditor0 on the parameter panel, and set the cell height to 10 px and font size to 10 px for the pop-up box.

    _g().getParameterContainer().getWidgetByName("dateEditor0").setPopupStyle({

        itemHeight: "10px",

        fontSize: "10px"

    });

    Example 3: In a general report, you can get the date widget dateEditor0 in a data entry cell, and set the cell height to 10 px and font size to 10 px for the pop-up box.

    _g().getWidgetByName("dateEditor0").setPopupStyle({

        itemHeight: "10px",

        fontSize: "10px"

    });

    Example 4: In a dashboard, you can get the date widget dateEditor0 in body, and set the cell height to 10 px and font size to 10 px for the pop-up box.

    _g().getWidgetByName("dateEditor0").setPopupStyle({

        itemHeight: "10px",

        fontSize: "10px"

    });

    iconNote: 
    If an error occurs due to incomplete creation of the report block object after adding the event, you can add a delay function to postpone the execution.
    setTimeout(function(){

    _g().getParameterContainer().getWidgetByName("dateEditor0").setPopupStyle({

        itemHeight: "10px",

        fontSize: "10px"

    });

    }, 500);


     Application 

    Example 

    You can modify the cell height  to 10 px and font size to 10 px for the pop-up box of the date widget dateEditor0.

    For details, you can download the template Modifying the Date Widget Style.cpt.

    04.png

    Mobile Terminal This API is not supported on mobile terminals.


    Attachment List


    Theme: Secondary Development
    • 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