Extjs DataView to display tooltips

jeewiya picture jeewiya · Jan 3, 2012 · Viewed 7.3k times · Source

I am using ExtJS DataView for my image gallery. This is my way for item tooltip. It's in tpl.

 new Ext.XTemplate(
    '<tpl for=".">',
        '<div class="thumb-wrap" data-qtip="{shortname}">',
            '<img class="file-image" src="{thumb}" />',
        '</div>'
    '</tpl>'
 );

It's working correctly, but I want to set showDelay value for my tooltip.

Is there any way to set showDelay for dataview item tooltip?

Answer

egerardus picture egerardus · Jan 4, 2012

Try implementing tooltips like this instead, it will give you all of the config options:

Add the following after you declare your grid (where myGridPanel is your Ext.grid.Panel). You may have to adjust it somewhat for your needs. Also take the tip out of the template.

myGridPanel.getView().on('render', function(view) {
    view.tip = Ext.create('Ext.tip.ToolTip', {
        target: view.el,
        delegate: view.itemSelector,
        trackMouse: true,
        minWidth: 300, 
        maxWidth: 500,
        dismissDelay: 0,
        showDelay: 800,
        renderTo: Ext.getBody(),
        listeners:{
            beforeshow: function updateTipBody(tip){
                tip.update(
                    view.getRecord(tip.triggerElement).get('shortname')
                );
            }
        }
    });
});