JS Traverse to Get All Cell Values

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

    Sometimes, it is required to get all cell values, as shown bellow:

    2.gif     

    II. Example

    2.1 Data preparation

    Create a new report and add dataset ds1:

    SELECT * FROM Sales_Volume where Region='North China' and Product ='Milk'


    2.2 Design Report

    Design the report body as follows:



    2.3 Add button and click event

    Add a button widget at the parameter pane,and set its name as Get all cells value. Add a Click event for the button:

    image (2).png

    JavaScript codes:

    var _obj = $(".x-table tr");
    var _length = _obj.length;
    for(var i = 0; i < _length; i++) {
        var _td = _obj.eq(i).find("td");
        for(var j = 0; j < _td.length; j++) {
            var _val = _td.eq(j).text();
            var _tval = $.trim(_val);
            if(_tval!=""){
            alert(_val);
            }
        }
    }


    2.4 Show results

    Save report, and select Pagination Preview. Click button Get all cells value, the browser will prompt all the cell values:

    2 (1).gif

    Tips:Not support mobile devices.

    III. Completed template

    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