Jump to content

Tooltip on uniTreeview only when mouseover icon, not an entire node


Linda

Recommended Posts

Hi, I'm using the following code to create tooltips on UniTreeview nodes. It works just fine. But I'd like to sometimes only show the tooltip when the user mouses over the icon instead of the whole line. How can I do that? Thanks.

NavTree.ClientEvents.ExtEvents.Values['viewready'] :=
    'function viewready(sender, eOpts) '+
    '{ '+

    '    sender.view.tip = Ext.create(''Ext.tip.ToolTip'', { '+
    '        target: sender.view.el,'+
    '        delegate: sender.view.cellSelector, '+
    '        trackMouse: true, '+
    '        showDelay: 500, '+
    '        hideDelay: 10, '+
    '        dismissDelay: 0,  ' +             // since the tip could be long, keep the tooltip up as long as mouse is over
    '        componentCls: ''overviewTip'', ' +
    '        renderTo: Ext.getBody(), '+
    '        listeners: { '+
    '            beforeshow: function updateTipBody(tip) { '+
    '                gridColums = sender.view.getGridColumns(); '+
    '                column = gridColums[tip.triggerElement.cellIndex]; '+

    '                record = sender.view.getRecord(tip.triggerElement.parentNode); '+

    '                cellTd = sender.view.getCell(record, tip.triggerElement.cellIndex);               ' +

    '                if (cellTd) {  ' +
    '                 cellInnerDiv = cellTd.querySelector(''.x-grid-cell-inner'');  ' +

    '                 if (cellTd.hasAttribute("coverview"))  { ' +
    '                  tip.update(cellTd.getAttribute("coverview"));   }' +
    '                 else         ' +
    '                  if ((cellInnerDiv.scrollWidth > cellInnerDiv.offsetWidth)    ){' +
   // '                    && cellTd.hasAttribute(''overflow-tooltip'')){ '+
    '                    tip.update(record.data.text); '+
    '                  } else { '+
    '                    return false; '+
    '                  } '+
    '                }   ' +  // if celltd
    '                else { '+
    '                    return false; '+
    '                } '+
    '            } '+
    '        } '+
    '    }); ' +

    '} ';

Link to comment
Share on other sites

18 hours ago, Linda said:

Can you just tell me how to detect the mouseover of the icon?

Hello,

A simple example:

UniTreeView.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts) 
{
    sender.getView().tip = Ext.create('Ext.tip.ToolTip', {
        target: sender.getView().getEl(),
        delegate: '.x-tree-icon',
        trackMouse: true,
        renderTo: Ext.getBody(),
        listeners: {
            beforeshow: function updateTipBody(tip) {
                gridColums = sender.getView().getGridColumns();
                column = gridColums[tip.triggerElement.cellIndex];
                record = sender.getView().getRecord(tip.triggerElement.parentNode);
                tip.update(record.data.text);
            }
        }
    });
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...