JS Hover to display images in the cell

  • Last update:  2020-11-16
  • I. Overview

    1.1 Problem

    Hover the mouse on any cell in the table, the preset image will be displayed, and the image disappears when the mouse leaves the cell. As shown below:


    1.2 Solution

    Reference the CSS file and JavaScript file, and place the image to be displayed in the current cell in a Tooltip function (floating prompt) to achieve the effect of displaying the image when the mouse hovers on the cell.   

    II. Sample

    2.1 Template preparation

    1. To create a new dataset query, use the following SQL statement: SELECT * FROM Sales

    2. Insert the formula in B1: split($col, ",")

    3. Insert the formula in A2: ds1.select(#0)

    4. Insert the formula in B2: ds1.value(A2, B1)

    5. Add all borders.

    6. Add the parameter [col] to the parameter pane, and select the drop-down box widget.

    7. Widget value is [formula], enter: TABLEDATAFIELDS("ds1")

    8. Select data dictionary type to be [formula],  input [actual value] as: TABLEDATAFIELDS("ds1")


    2.2 Reference files

    Click [template] > [Web template attributes]. In the [reference Css] and [references JavaScript] tab, quote bootstramp js and css files, as shown below: 

          

    2.3 Add loading end event

    Click [template] > [template Web attributes] > [Pagination preview], was added in the event setting [loading end] event, as shown below:

    javascript:

    $(".x-table td[id^=E]").tooltip({
    placement: "right",
    html: true,
    title: function() {
    var goodsno = $(this).html();
    return '<img width=100 height=30 src="https://www.finereport.com/en/wp-content/themes/Newweb/images/header/header_logo.png" />';
    }
    });



    2.4 Preview effect

    Click the pagination preview, you can see that when the mouse hovers over the E column, the image will be displayed.

    III. Download 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