The tooltip does not display at some times in flexgrid Cell Notes demo

Posted by: 1071118072 on 20 November 2024, 11:11 pm EST

  • Posted 20 November 2024, 11:11 pm EST

    The demo url is https://developer.mescius.com/wijmo/demos/Grid/CustomCells/CellNotes/purejs.

    Enter this demo and don’t click any cell, the tooltip works when I hover the cell in first row and first column. But when I click the cell in first row and second column, the tooltip does not work again. The reason is that my operation triggered the updatingView method at last and dispose the tooltip. What is the correct way to dispose tooltip when updating view ?

    updatingView: () => {
        tooltip.dispose()
    }

  • Posted 21 November 2024, 7:55 am EST

    Hi Bu,

    The tooltip.dispose is called in the updatingView method for demonstration purpose only. To properly dispose you may dispose the tooltip when it is no longer required.

    For example, if the control using the tooltip is removed then you may remove the tooltip as well.

    See the sample code:

    Sample Code:

      grid.originalDispose = grid.dispose;
      grid.dispose = function () {
        tooltip.dispose();
        if (grid) grid.originalDispose();
      };
    

    In the sample, notice I am modifying the dispose method so the tooltip is also disposed when the flexgrid is disposing then the FlexGrid is removed as well.

  • Posted 21 November 2024, 11:17 pm EST

    I thought that not releasing tooltip during use FlexGrid might waste computing resources. Thank you !

  • Posted 22 November 2024, 8:29 am EST

    Hi Bu,

    It generally shouldn’t but if you want to clear the tooltip when using FlexGrid I would suggest you to use the following lines of code:

    for (let i = tooltip._tips.length - 1; i >= 0; i--) {
              let tip = tooltip._tips[i];
              if (!tip.element.parentElement) { // Check if element is detached           
                tooltip.setTooltip(tip.element, null); //remove all tooltip events from the element, also removes the tip
              }
            }
    

    This will clear up the Tooltip and remove any unused ToolTip reference.

    Regards,

    Akshay

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels