[英]Add a tooltip to an ExtJS checkcolumn
我在checkcolumn
中有一個ExtJS checkcolumn
Ext.tree.Panel
:
{
xtype: 'checkcolumn',
dataIndex: 'enabled',
hideable: true,
stateId: 'enabledColumn',
width: 30,
listeners: {
checkchange: function (grid, rowIndex, checked, eOpts) {
var tree = grid.up('processtree');
tree.getController().onCheckChange(tree, rowIndex, checked);
}
}
}
我需要為此添加一個tooltip
,其樣式類似於同一網格中的其他列,即
{
xtype: 'actioncolumn',
width: 30,
hideable: false,
stateId: 'deleteColumn',
items: [{
icon: 'images/delete2.png',
tooltip: 'Delete',
handler: 'onDelete'
}]
}
但是,該文檔的實現方式模糊不清,只是說明工具提示可用於列標題,這是不希望的,因為頁面上的其他工具提示出現在其各自列內的項目上。
如何將類似樣式的工具提示應用於其他列? 鑒於所有代碼Ext.tree.Panel
拆分為單獨的文件,此工具提示是否必須是單獨的實體(單獨的文件,並列在Ext.tree.Panel
的requires
)?
如果我做對了,您想在列中的每個項目上顯示工具提示。 為了做到這一點,您可以像這樣使用渲染的列:
{
xtype: 'gridcolumn',
renderer: function(value, meta, record, row, col) {
meta['tdAttr'] = 'data-qtip="the tooltip for " + value;
return whatYouWantToDisplayInThatColumnsCell;
}
}
對於檢查列:
{
xtype: 'checkcolumn',
renderer: function(value, meta, record, row, col) {
meta['tdAttr'] = 'data-qtip="the tooltip for "' + value + "'";
return new Ext.ux.CheckColumn().renderer(value);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.