JS Get the Row Number of Cell Currently being Edited

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

    1.1 Requirement

    Show the row number on the top when editing any cell in the row.


    1.2 Solution

    The contentPane attribute owns an event listener named cellselect, which will be triggered when a cell is selected.

    II. Sample

    2.1 Design a template


    2.2 Add an event

    Select [Template] > [Web Attributes], and choose [Data Entry Settings].

    Select [Indivisually set for the report] and click [+] to add a [Load End] event.

    Input the JS code:

    contentPane.on("cellselect", function(td) {
        //Capture the event. td is the event object, i.e. the cell that trigger the event.
        var num = contentPane.curLGP.getTDRow(td) - 2;
        //Get current row number. The first row begins from row 3,     so the row number subtracts 2.
        contentPane.curLGP.setCellValue("D1", null, num);
    }); //Let D1 display the row number.

    Note

    • To get the column number , use contentPane.curLGP.getTDCol(td). However, the column numbers are in alphabetical format, so they cannot do the subtraction directly.


    2.3 Preview

    Choose [Data Entry Preview]

    III. Download the template

    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