最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Extjs 4 grid mouseover show full cell value - Stack Overflow

programmeradmin0浏览0评论

I've got a grid with a long string in one of the columns. I would like the full string to appear when the user mouses over any cell in this column.

So far I have it working where a tooltip pops up for any cell in this column but they don't display the text. The tooltip always just says "Icon Tip".

How do I get the qtip to display the variable val instead of the string "Icon Tip"?

Ext.define('AM.view.user.List' , {
    extend: 'Ext.grid.Panel',
    .......
    initComponent: function() {
        function renderTip(val, meta, rec, rowIndex, colIndex, store) {
            meta.tdAttr = 'data-qtip="Icon Tip"';
            return val;
        };
        this.columns = [
            {header: 'First Name', dataIndex: 'FirstName', width: 75},
            {header: 'Last Name', dataIndex: 'Last', width: 75},
            {header: 'Perm', dataIndex: 'Perm', width: 75},
            {header: 'Comment', dataIndex: 'Comments', width: 150, renderer: renderTip}
        ];
        this.callParent(arguments);
    }
});

I've got a grid with a long string in one of the columns. I would like the full string to appear when the user mouses over any cell in this column.

So far I have it working where a tooltip pops up for any cell in this column but they don't display the text. The tooltip always just says "Icon Tip".

How do I get the qtip to display the variable val instead of the string "Icon Tip"?

Ext.define('AM.view.user.List' , {
    extend: 'Ext.grid.Panel',
    .......
    initComponent: function() {
        function renderTip(val, meta, rec, rowIndex, colIndex, store) {
            meta.tdAttr = 'data-qtip="Icon Tip"';
            return val;
        };
        this.columns = [
            {header: 'First Name', dataIndex: 'FirstName', width: 75},
            {header: 'Last Name', dataIndex: 'Last', width: 75},
            {header: 'Perm', dataIndex: 'Perm', width: 75},
            {header: 'Comment', dataIndex: 'Comments', width: 150, renderer: renderTip}
        ];
        this.callParent(arguments);
    }
});
Share Improve this question edited Nov 9, 2015 at 16:14 MarthyM 1,8492 gold badges22 silver badges24 bronze badges asked Aug 30, 2012 at 23:28 alex9311alex9311 1,4101 gold badge21 silver badges43 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 13

Figured it out on the sencha forums, the correct code would be:

function renderTip(value, metaData, record, rowIdx, colIdx, store) {
    metaData.tdAttr = 'data-qtip="' + value + '"';
    return value;
};

I guess there was some string/variable concatenation I needed to use

http://www.sencha.com/forum/showthread.php?179016-Grid-cell-tooltip

You already have the value, it gets passed as the first argument to the renderer. If you need more information, you also have the record.

发布评论

评论列表(0)

  1. 暂无评论