Extjs 4网格鼠标经过显示完整的单元格值

时间:2022-04-12 03:47:50

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而不是字符串“图标提示”?

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);
    }
});

3 个解决方案

#1


13  

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

#2


1  

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.

您已经有了这个值,它作为第一个参数传递给渲染器。如果你需要更多的信息,你也有记录。

#3


0  

Using this code works, but not ALL of the value is showing in the pop up. I have some values in the columns that are over 45 characters, and I am only seeing the first 30, then the value showing in the pop-up is getting cut off. How to see all the value in the pop-up? Do I have to increase the WIDTH of the pop-up window?

使用此代码可以工作,但不是所有的值都显示在弹出窗口中。我有一些列中有超过45个字符的值,我只看到了前30个,然后弹出框中的值就被截断了。如何在弹出框中看到所有的值?是否需要增加弹出窗口的宽度?

#1


13  

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

#2


1  

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.

您已经有了这个值,它作为第一个参数传递给渲染器。如果你需要更多的信息,你也有记录。

#3


0  

Using this code works, but not ALL of the value is showing in the pop up. I have some values in the columns that are over 45 characters, and I am only seeing the first 30, then the value showing in the pop-up is getting cut off. How to see all the value in the pop-up? Do I have to increase the WIDTH of the pop-up window?

使用此代码可以工作,但不是所有的值都显示在弹出窗口中。我有一些列中有超过45个字符的值,我只看到了前30个,然后弹出框中的值就被截断了。如何在弹出框中看到所有的值?是否需要增加弹出窗口的宽度?