开发者

Extjs4 set tooltip on each column hover in gridPanel

开发者 https://www.devze.com 2023-04-07 21:32 出处:网络
I am getting tooltip on mouse hover by e开发者_运维百科ach row for current column but I am unable to get next column tooltip on continue hover on same row.

I am getting tooltip on mouse hover by e开发者_运维百科ach row for current column but I am unable to get next column tooltip on continue hover on same row.

But I can get it if I hover on another row & again hover any column of the previous row by using:

listeners:{
'itemmouseenter': function (view, record, item, index, e, eOpts) {
        var gridColums = view.getGridColumns();
        var column = gridColums[e.getTarget(this.view.cellSelector).cellIndex];
        Ext.fly(item).set({ 'data-qtip': 'Des:' + column.dataIndex });

  }
}

Can anyone show me what I'm missing or point me in the right direction?


I have an easy one, using the renderer function:

{
    xtype : 'gridcolumn',
    dataIndex : 'status',
    text : 'Status',
    renderer : function(value, metadata) {
                    metadata.tdAttr = 'data-qtip="' + value + '"';
                    return value;
                }
}


I was looking through this. I could manage to get the tool tip for each cell by doing something like this:

 Ext.getCmp('DynamicDemandGrid').getView().on('render', function(view) {
    view.tip = Ext.create('Ext.tip.ToolTip', {
        // The overall target element.
        target: view.el,
        // Each grid row causes its own seperate show and hide.
        delegate: view.cellSelector,
        // Moving within the row should not hide the tip.
        trackMouse: true,
        // Render immediately so that tip.body can be referenced prior to the first show.
        renderTo: Ext.getBody(),
        listeners: {
            // Change content dynamically depending on which element triggered the show.
            beforeshow: function updateTipBody(tip) {
                var gridColums = view.getGridColumns();
                var column = gridColums[tip.triggerElement.cellIndex];
                var val=view.getRecord(tip.triggerElement.parentNode).get(column.dataIndex);
                tip.update(val);
            }
        }
    });
});

Let me know if it helps


{
    text: name,
    width: 80,
    dataIndex: dataIndex,
    sortable: true,
    listeners: {
        afterrender: function ()
        {
            Ext.create('Ext.ToolTip',
            {
                target: this.getEl(),
                anchor: direction | "top",
                trackMouse: true,
                html: this.text
            });
        }
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号