简体   繁体   English

带工具提示的ExtJS 4.2.1网格字段

[英]ExtJS 4.2.1 grid field with tooltip

I'm trying to get a hover/tooltip effect for some text in an ExtJS (4.2.1) grid. 我正在尝试为ExtJS(4.2.1)网格中的某些文本提供悬停/工具提示效果。 For some reason, the tooltip span is being occluded by the pretty much everything else. 由于某种原因,工具提示span几乎被其他所有事物所遮挡。

Seems to be an issue with stacking, but I'm not sure the best way to bring the span in front of everything else (other rows, and the frame surrounding the grid). 似乎是堆叠问题,但是我不确定将span置于其他所有内容(其他行以及围绕网格的框架)前面的最佳方法。

Fiddle: 小提琴:
https://jsfiddle.net/z3jj601f/ https://jsfiddle.net/z3jj601f/

I tried using z-index to no avail. 我尝试使用z-index无济于事。 Can anyone tell me the right way to bring the tooltip span to the absolute foreground? 谁能告诉我将工具提示范围带到绝对前景的正确方法?

you could achieve this using a Ext.tip.ToolTip. 您可以使用Ext.tip.ToolTip来实现。 As in 4.2.1 documentation you can delegate the tooltip show/hide specifying a dom selector. 与4.2.1文档中一样,您可以委派工具提示show / hide来指定dom选择器。

In you case: 在您的情况下:

  1. Add a custom class to you the cells you want the tooltip for 在您想要工具提示的单元格中添加一个自定义类

     columns: [{ ... }, { text: 'Status', dataIndex: 'status', tdCls: 'my-tooltip' } 
  2. Create the tooltip with delegate 使用委托创建工具提示

     var view = grid.getView(); var tip = Ext.create('Ext.tip.ToolTip', { target: view.el, delegate: '.my-tooltip', trackMouse: true, renderTo: Ext.getBody(), listeners: { beforeshow: function updateTipBody(tip) { var record = view.getRecord(Ext.get(tip.triggerElement).up('tr')); // Update tooltip text according to current record tip.update('Over record ' + record.getId()); } } }); 

Here is the updated fiddle: https://jsfiddle.net/gbb5xh74/ 这是更新的小提琴: https : //jsfiddle.net/gbb5xh74/

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

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