简体   繁体   English

Extjs 4网格鼠标悬停显示完整的单元格值

[英]Extjs 4 grid mouseover show full cell value

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"? 如何让qtip显示变量val而不是字符串“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);
    }
});

Figured it out on the sencha forums, the correct code would be: 在sencha论坛上找出来,正确的代码是:

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 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. 如果您需要更多信息,您也有记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM