JS Edit widget on click once

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

    1.1 Problem

    When there are many widgets in one report, to enhance performance, sometimes we will not display the widget directly. In this way, by default, you need to double-click the cell to enter the edit mode, which is cumbersome and sometimes may cause error when the input is Chineses, Korean, etc.              

    1.gif

    So how to automatically enter the editing state after selecting a cell once, as shown below:

    2.gif


    1.2 Solution

    1)Solution 1

    Use the contentPane.on event to monitor the cell selection event, and set the editing event for the selected cell.

    2) Solution 2

    Use the setEditOnClick() and setEditOnMove() provided by contentPane to set whether to edit directly when clicking to select a cell or pressing the Tab key to move the cursor.    

    II. Example

    2.1 Solution 1

    Add a loading end event to the template, as shown below:

    3.png

    JavaScript:

    //Monitor cell selection
    contentPane.on('cellselect',function(td){
    //Call edit event on selected cell
    contentPane.curLGP.editTDCell(td);
    })

    Note: This method is suitable for direct mouse selection or Tab key selection.


    2.2 Solution 2

    Add a loading end event to the template, as shown below:

    4.png

    JavaScript:

    //Edit on click
    contentPane.setEditOnClick(true);
    //Edit when cursor is moved using Tab key
    contentPane.setEditOnMove(true);


    2.3 Summary

    Both of the above two methods can directly display the widget and enter edit mode, which improves the usability of our report and a better interactive experience.

    Method one can be used in conjunction with other codes, such as custom add and delete row buttons or JS to remove the red triangle in the upper left corner of the report.

    Method two is simpler and more intuitive, but you must add all two lines of code when using it.


    2.4 Preview effect

    Save the template, select the data entry preview , and the effect is shown in the following figure:

    5.gif


    III. Download template

    3.1 Solution 1

    1.cpt


    3.2 Solution 2

    2.cpt


    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