var store = Ext.create('Ext.data.ArrayStore', {
fields: ['company', 'price', 'change'],
data: [
['3m Co', 71.72, 0.02],
['Alcoa Inc', 29.01, 0.42],
['Altria Group Inc', 83.81, 0.28],
['American Express Company', 52.55, 0.01],
['American International Group, Inc.', 64.13, 0.31],
['AT&T Inc.', 31.61, -0.48]
]
});
var grid = Ext.create('Ext.grid.Panel', {
title: 'Array Grid',
store: store,
columns: [
{text: 'Company', flex: 1, dataIndex: 'company'},
{text: 'Price', width: 75, dataIndex: 'price'},
{text: 'Change', width: 75, dataIndex: 'change'}
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
var view = grid.getView();
var tip = Ext.create('Ext.tip.ToolTip', {
// The overall target element.
target: view.el,
// Each grid row causes its own separate show and hide.
delegate: view.itemSelector,
// 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) {
tip.update('Over company "' + view.getRecord(tip.triggerElement).get('company') + '"');
}
}
});
5条答案
按热度按时间4ioopgfo1#
在网格列配置中使用渲染器。编写一个函数,该函数将向渲染器函数Map返回期望值。
示例工作示例:
这里是(metaData.tdAttr='data qtip=“'+deviceDetail+'”';)需要在工具提示中显示数据的位置
thtygnil2#
您可以使用sencha文档中的以下示例
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.tip.工具提示
kxkpmulp3#
按如下方式使用列渲染器功能:
im9ewurl4#
最简单的方法:
声明列时,请使用属性
attribute
:xmakbtuz5#
我在渲染器中使用了: